简体   繁体   English

如何将access_token直接传递给nuxt / auth软件包

[英]How to pass the access_token as directly to the nuxt/auth package

How to pass access_token to the user endpoint in nuxt/auth package while you got the access_token as directly without any username and password, I don't want to call login before the user endpoint because of access_token is already and I just want to call user enpoint, finally how do i pass access_token and call the user endpoint directly? 如何在没有任何用户名和密码的情况下直接将access_token传递给nuxt/auth包中的access_tokenuser端点,我不想在user端点之前调用login ,因为access_token已经存在,我只想调用user请问,最后我该如何传递access_token并直接调用user端点? Thanks so much for any help! 非常感谢您的帮助!

  // Auth module
   auth: {
    plugins: [
        { src: '~/plugins/auth' }
    ],
    redirect: {
        login: '/login',
        logout: '/',
        home: false
    },
    strategies: {
        local: {
            endpoints: {
                login: { url: 'account/token', propertyName: 'result.access_token' },
                logout: { url: 'account/logout' },
                user: { url: 'account/self', propertyName: 'result' }
            }
        }
    }
}

To set token you could use this.$auth.setToken(...) . 要设置令牌,可以使用this.$auth.setToken(...) To call user endpoint you could use this.$auth.fetchUser() . 要调用用户端点,可以使用this.$auth.fetchUser()

Docs 文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 auth-module、Nuxt.js 获取 access_token - How can I get access_token from auth-module, Nuxt.js 如何将服务OAuth access_token从PHP传递到JavaScript - How to pass Service OAuth access_token from PHP to JavaScript Auth0.js:有没有办法将Google access_token静默替换为auth0 access_token? - Auth0.js: Is there a way to silently replace a google access_token into an auth0 access_token? 如何使用 'id_token'、'access_token'、expiry 等直接创建 userManager? - How can create userManager directly with 'id_token', 'access_token', expiry etc.? 如何将access_token从Dom传递或解析到一个变量,然后可以存储和调用access_token? - How do I pass or parse that access_token from the Dom to a Variable I can then Store and call for access_token? 访问令牌过期时如何在带有 keycloak 的 Nuxt auth 模块(oauth2)中使用刷新令牌 - How to use refresh token in Nuxt auth module (oauth2) with keycloak when access token expired 如何获取谷歌分析的access_token? - How to obtain access_token for google analytics? 如何解决OAuth 2.0中的access_token - how to solve access_token in OAuth 2.0 如何从Java服务器将Google api access_token传递给gapi javascript客户端? - How can I pass a google api access_token from java server to gapi javascript client? 无法从 TokenProvider commercetools/sdk-auth 获取 access_token 和 token_type - Can not get the access_token and token_type from TokenProvider commercetools/sdk-auth
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM