Angular client getting OKTA token using OpenID

Hi Team,

I have an Angular app (SPA, client) and an ASP.Net API (both hosted on same server but different applications). I am looking to implement token based authentication with OKTA using OpenId connect.

Angular app will redirect to OKTA login page and in return gets the Bearer Token using OpenID from OKTA. This Bearer token will be passed to the ASP.NET API and it should have logic to authenticate the Bearer token passed.

I have registered the SPA and passing client id to OKTA.

My code is not generating bearer token and bearer token received in postman is not getting validated.

Can someone provide working code:
1. To call OKTA from Angular SPA and get Bearer token
2. To validate Bearer token in ASP.NET API (locally or in OKTA)

The snippet provided in samples are not working for me. If someone can provide a working code, it will be helpful.

Hey there.

  1. Here is a link to our Angular sample app. This should have everything you need to receive ID and access (bearer) tokens from your Okta org.

  2. Here is a link to an ASP.NET resource server sample app where you can test making api calls with the access token retrieved in #1.

If these are the snippets you were referring to that you couldn’t get working, let us know what issues you were running into as these will be the best option we can offer when it comes to code samples. Thanks!

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