Javascript Nuxtjs auth模块-从未调用auth策略配置中的令牌端点
我们有两个端点Javascript Nuxtjs auth模块-从未调用auth策略配置中的令牌端点,javascript,vue.js,nuxtjs,nuxt-auth,Javascript,Vue.js,Nuxtjs,Nuxt Auth,我们有两个端点/auth和/token。端点/auth返回在调用/token获取访问令牌时可以使用的授权代码 使用NuxtJS,auth模块成为了一种可行的方法。据我所知,登录过程this.$auth.loginWith(“公司”)运行良好。我被重定向到登录页面。我可以输入我的凭据,当这些凭据有效时,我将被重定向到配置的URL 到那时为止,一切正常。重定向将授权代码作为请求参数传递 这是URL的外观: http://localhost:3000/?state=Y6CWcCZanJ&ses
/auth
和/token
。端点/auth
返回在调用/token
获取访问令牌时可以使用的授权代码
使用NuxtJS,auth
模块成为了一种可行的方法。据我所知,登录过程this.$auth.loginWith(“公司”)
运行良好。我被重定向到登录页面。我可以输入我的凭据,当这些凭据有效时,我将被重定向到配置的URL
到那时为止,一切正常。重定向将授权代码作为请求参数传递
这是URL的外观:
http://localhost:3000/?state=Y6CWcCZanJ&session_state=2c966cd9-5834-4045-9bfb-6aa9f616f841&code=fbabf615-cd5e-4479-818a-6a7ba72de01b.2c966cd9-5834-4045-9bfb-6aa9f616f841.553d562b-c454-4681-83ae-98cd93dbfa90
然而,通过这个code
我希望auth
模块会自动调用/token
端点。但事实并非如此。为什么呢
使用this.$auth.loginWith(“公司”)
后是否需要显式调用它?比如:
this.$auth.loginWith(“公司”);
这是。$auth.fetchToken();
还是含蓄的
这是numxt.config.js
...
auth: {
strategies: {
company: {
scheme: "oauth2",
endpoints: {
authorization:
"https://login.mycompany.com/auth/realms/apps/protocol/openid-connect/auth",
token:
"https://login.mycompany.com/auth/realms/apps/protocol/openid-connect/token",
userInfo:
"https://login.mycompany.com/auth/realms/apps/protocol/openid-connect/userinfo",
logout: "http://localhost:3000/logout"
},
token: {
name: "Authorization",
property: "access_token",
type: "Bearer",
maxAge: 1800
},
refreshToken: {
property: "refresh_token",
maxAge: 60 * 60 * 24 * 30
},
responseType: "code",
grantType: "authorization_code",
accessType: undefined,
redirectUri: "http://localhost:3000",
logoutRedirectUri: undefined,
clientId:
process.env.CLIENT_ID ||
"3004761-241-dab74c5e-ad70-11eb-bea4-4193bd361dc612123",
scope: ["all"],
codeChallengeMethod: "S256"
}
}
},
...