Our system has two important endpoints, namely /auth
and /token
. The endpoint /auth
is responsible for providing the authorization code required to call /token
in order to obtain an access token.
The utilization of NuxtJS has made the auth
module a preferred method. The login process using
this.$auth.loginWith("company")
appears to be functioning properly based on my observations. Upon entering valid credentials, I am redirected to the Login Page and subsequently directed to the configured URL.
Everything seems to be progressing as expected until this point. The redirection includes the authorization code as part of the request parameters.
Here is how the URL structure looks:
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
However, despite having this code
, the auth
module does not seem to automatically trigger the /token
endpoint. What could be causing this delay?
Is it necessary to explicitly call it after executing
this.$auth.loginWith("company")
? For instance:
this.$auth.loginWith("company");
this.$auth.fetchToken();
Or should this action be triggered implicitly?
The configuration details can be found in the nuxt.config.js
file:
...
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"
}
}
},
...