I am using okta-auth-js version 1.17 for my Angular 6 app. When upgrading to version 2.0, I am able to get the tokens back in the url, but the this.oktaAuth.token.parseFromUrl() method fails with AuthApiError. Can you please help to resolve this issue, is there any change in the parseFromUrl method in version 2.0?
Login method
login() {
// Launches the login redirect.
this.oktaAuth.token.getWithRedirect({
responseType: [‘id_token’, ‘token’],
scopes: [‘openid’]
})
//.catch(err => console.error(‘error logging in’, err));
}
HandleAuthentication method after getting the tokens
async handleAuthentication() {
try {
const tokens = await this.oktaAuth.token.parseFromUrl();
tokens.forEach(token => {
if (token.idToken) {
this.oktaAuth.tokenManager.add(‘idToken’, token);
}
if (token.accessToken) {
this.oktaAuth.tokenManager.add(‘accessToken’, token);
}
});
} catch (error) {
console.log(error);
}
}
The error is thrown from the catch block of handleAuthentication method