Okat Angular - AuthSdkError: Unable to parse a token from the url

Hi, while integrating my app with Okta, encountered the following error: AuthSdkError: Unable to parse a token from the url
I have been following the tutorial: https://developer.okta.com/code/angular/okta_angular_auth_js/
Here is my okta config:

oktaAuth = new OktaAuth({
url: ‘https://{domain}.oktapreview.com/’,
clientId: ‘0oakvjseautMeidZs12’,
issuer: ‘https://{domain}.oktapreview.com/’,
redirectUri: ‘https://abc.com/home’,
authorizeUrl: ‘https://{domain}.oktapreview.com/oauth2/v1/authorize’
});

I am calling handleAuthentication function in home.component.ts constructor. After logging in page is redirecting to https://abc.com/home but isAuthentication() always returning false and getting the error. And when I try debugging, observed that parseFromUrl is executing with redirectUrl(“https://abc.com/home?code=cP_C62-O9JigsKxLw4yJ&state=PIXzSS5950Dfwhw4T6evGhvERcoyTc75SwnZHGTLiqIGGuwnDuju7ENiZdBjJRfA”), but hash is “”.

I am new to angular and Okta. Could anyone please help? Thank you.

You don’t have to use the Auth JS library to add authentication to your Angular app. It’s pretty low level. You might like our Angular SDK better. In fact, you can install our Angular SDK with just one command:

ng add @oktadev/schematics

This blog post has a full CRUD example with Angular and Spring Boot:

Hope this helps,

Matt

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.