如何使用Auth0 SPA和Vue Apollo加载标头

问题描述

我想将Auth0 SPA与Vue Apollo一起使用。 问题是我不知道如何从Auth0中的Vue Apollo中的Authorization Header加载令牌。

在vue-apollo.js(https://vue-cli-plugin-apollo.netlify.app/guide/auth.html

getAuth: () => {
    const token = ''
    return token ? `Bearer ${token}` : "";
  },

对于我的项目,我遵循了https://auth0.com/docs/quickstart/spa/vuejs/01-login。 有一个名为getTokenSilently()的方法

 /** Returns the access token. If the token is invalid or missing,a new one is retrieved */
 getTokenSilently(o) {
    return this.auth0Client.getTokenSilently(o);
 },

如何在vue-apollo.js中调用方法以检索令牌?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)