You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i am trying to solve this problem but it wont. I want to signup with google in my Angular 18 setup.
If i do the implicit flow everything works fine and i can read the google user with all properties.
But since the code flow is the remmoneded and more secure (as said) i want to use this.
If i explicit write in the configresponseType: 'code' i cant login (i only change this and i get the error).
I can do the full angular login process and get redirected to my url. But then i get the following error:
ERROR Error: 'tokenEndpoint' should not be null
My setup:
oAuthConfig: AuthConfig = {
issuer: 'https://accounts.google.com',
strictDiscoveryDocumentValidation: false, // Set to false to disable strict validation
redirectUri: window.location.origin + '/authentication',
clientId: 'myid.apps.googleusercontent.com',
scope: 'openid profile email',
responseType: 'code', // if i set this to true i get an error
useSilentRefresh: true, // Silent refresh via hidden iframe
silentRefreshTimeout: 5000, // Timeout in case of failure
timeoutFactor: 0.75, // Refresh the token when 75% of the access token lifetime has passed
showDebugInformation: false,
};
this is the login component
login() {
/* Initiate the external (google, etc...) auth process in order to trigger a response. */
// Step 1: Configure OAuth service
this.oAuthService.configure(this.oAuthConfig);
// Step 2: Load discovery document and try to log in with existing tokens
this.oAuthService.loadDiscoveryDocumentAndTryLogin({
onTokenReceived: context => {
console.debug('Login successful:', context);
},
onLoginError: err => {
console.error('Login error:', err);
}
}).then(() => {
// Step 3: If the user is not logged in, start the authorization code flow
// if (!this.oAuthService.hasValidAccessToken()) {
// this.oAuthService.initCodeFlow();
// }
this.oAuthService.initCodeFlow();
});
}
this is the calback method that is triggered on redirect url path:
callbackLogin(){
/*
While the login() method triggers the login process, this method recieves the response from the external authentication server.
The Login will be awaited. If it is finished we retrieve the data and write them to our database in order to create a sikuno user.
The Token refresh will be handeled by the external server since the useSilentRefresh is enabled.
*/
this.oAuthService.tryLogin({
// onTokenReceived: context => {
// console.debug("Token received during login callback", context);
// },
onLoginError: (err) => {
console.error('Error during login:', err);
}
}).then(() => {
// this.logout();
if (this.oAuthService.hasValidAccessToken()) {
// Once tryLogin has completed, you can safely check for tokens and claims
const identityClaims = this.oAuthService.getIdentityClaims();
// console.log("Identity Claims:", identityClaims);
console.log(
identityClaims['email'],
identityClaims['email_verified'],
identityClaims['given_name'],
identityClaims['family_name'],
identityClaims['picture']
);
}
// console.log("Has ID Token:", this.oAuthService.hasValidIdToken());
// console.log("Has Access Token:", this.oAuthService.hasValidAccessToken());
// console.log("ID Token:", this.oAuthService.getIdToken());
// console.log("Access Token:", this.oAuthService.getAccessToken());
// console.log("Refresh Token:", this.oAuthService.getRefreshToken());
// console.log("Access Token Expiration:", this.oAuthService.getAccessTokenExpiration()); // Returns the expiration date of the access_token as milliseconds since 1970. (Google expiration time is 1h)
});
}
I tried so many things and checkt different forums but it seems that noone has a similar problem (or i just didnt find it)
Help is much appreciated.
Thanks
The text was updated successfully, but these errors were encountered:
SteffHain
changed the title
Google Auth Code Flow 'tokenEndpoint' should not be null
Help Needed: Google Auth Code Flow 'tokenEndpoint' should not be null
Sep 20, 2024
Hi,
i am trying to solve this problem but it wont. I want to signup with google in my Angular 18 setup.
If i do the implicit flow everything works fine and i can read the google user with all properties.
But since the code flow is the remmoneded and more secure (as said) i want to use this.
If i explicit write in the config
responseType: 'code'
i cant login (i only change this and i get the error).I can do the full angular login process and get redirected to my url. But then i get the following error:
ERROR Error: 'tokenEndpoint' should not be null
My setup:
this is the login component
this is the calback method that is triggered on redirect url path:
I tried so many things and checkt different forums but it seems that noone has a similar problem (or i just didnt find it)
Help is much appreciated.
Thanks
The text was updated successfully, but these errors were encountered: