# Updrading to okta-auth-js version 2.0 from 1.17 gives AuthApiError

**URL:** <https://devforum.okta.com/t/updrading-to-okta-auth-js-version-2-0-from-1-17-gives-authapierror/5629>\
**Category:** Questions\
**Created:** [July 10, 2019, 10:21pm UTC](https://devforum.okta.com/t/updrading-to-okta-auth-js-version-2-0-from-1-17-gives-authapierror/5629 "2019-07-10T22:21:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alicehelen84](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@alicehelen84](https://devforum.okta.com/u/alicehelen84)\
**Post date:** [July 10, 2019, 10:21pm UTC](https://devforum.okta.com/t/updrading-to-okta-auth-js-version-2-0-from-1-17-gives-authapierror/5629/1 "2019-07-10T22:21:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [January 17, 2024, 11:44pm UTC](https://devforum.okta.com/t/updrading-to-okta-auth-js-version-2-0-from-1-17-gives-authapierror/5629/2 "2024-01-17T23:44:53Z")

</div>


