How to get acces token in may Angular app?

Hello
I am building my SPA in Angular. I have completed all steps in quickstarts and everything works(including login, signup an so on). I have connected my page with our back-end, but when i get logged in i recieve 401 error. My team tried to solve this and we recieve token(it is even shown in console) but my question is how to get acces token in Angular?

Hi @szynszyl.rogalewski,

In dev tools, after logging in there should be a /token request where the Access Token and ID Token are returned. If you copy and paste the Access Token into https://jwt.io/, does it look like the token can be decoded?

If not, it’s possible that you may need to register your API if you have not done so already: Register APIs

Once you register your API, you’ll use the API Identifier as the audience in your Angular app:

AuthModule.forRoot({
  // The domain and clientId were configured in the previous chapter
  domain: 'YOUR_DOMAIN',
  clientId: 'YOUR_CLIENT_ID',

  // Request this audience at user authentication time
  audience: 'YOUR_API_IDENTIFIER', 

  // ... other configs
})

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