Success Login and a Failed Exchange

I configured an API and application.
I have an angular app. I can login wit my user.
I see that in the logs (success login).
But than I have a Failed Exchange.
In the chrome dev tools, I see the following:

POST https://xxx.eu.auth0.com/oauth/token 401

hi @filip.debacker and thanks for reaching out to Auth0 Support!

Sounds like that error is related to your Authorization code flow not working as expected, here’s a list of our event type codes which may be useful.

You mentioned having an Angular application, is it modeled in Auth0 as a SPA or Regular Web Application (RWA)? For front end applications like that we recommend it being a SPA, in which case the Auth Code Flow is not recommended and should use the Implicit Flow, more on that here:

Please review those materials and if you’re still facing issues, could you please send me your tenant in a DM and I can review your setup further.

Best Regards,
Colin

Thanks for the info.
I’ve implemented the authorization like described in the Login and API sample. So that is the Implicit Flow.


I created a new Application, now I can login.
But when I check my token with jwt.io, I get a signature error due to padding.

Also, localhost works fine, no error in dev console.

On the prod server, I got an error:

ERROR NullInjectorError: StaticInjectorError[t -> t]:
StaticInjectorError(Platform: core)[t -> t]:
NullInjectorError: No provider for t!
at t.get (https://fdbapps.filipdebacker.be/main.da36deeb0148d50b543f.js:1:53846)

@colin.coutts I am getting the same error with my Angular SPA. I followed the https://auth0.com/blog/securing-angular-applications-with-auth0-and-deploying-to-netlify/ tutorial and I am also getting the FAILED EXCHANGE ERROR for both Google/Facebook Social Logins

{
  "date": "2020-08-13T08:12:55.226Z",
  "type": "feacft",
  "description": "Unauthorized",
  "connection_id": "",
  "client_id": "gNkJFP7YEvD4OrBdbgjHYZzM8XwkhjYS",
  "client_name": null,
  "ip": "116.86.21.67",
  "user_agent": "Safari 13.1.0 / Mac OS X 10.15.4",
  "details": {
    "code": "*************4s5"
  },
  "hostname": "vanna.au.auth0.com",
  "user_id": "",
  "user_name": "",
  "log_id": "90020200813081256620000465921382865527023048504050188338",
  "_id": "90020200813081256620000465921382865527023048504050188338",
  "isMobile": false
}

I am getting this error even after successful SignUp for Angular SPA https://vannatok.netlify.app/

I found the same issue with my react app today.
You can try this.

First, I created a new app setting.
Then I exported my settings, and compare it.
I found differences between old app and new app.
that differences are grant_types and token_endpoint_auth_method.

Hi @masaki @sagun786 and @filip.debacker!

Thanks for reaching out! Let’s see what we can do :slightly_smiling_face:

Would you mind all sending me your tenant name in a DM as well as a .har file for me to look into this further? More details on that here:

Just so I have some clarity on this, are you seeing these errors on all logins or are they specific only to Social Logins (Facebook/Google etc.)? Also is this issue only when you deploy your app or is it reproducible locally as well?

@masaki what were the differences that you noticed? The token_endpoint_auth_method should be set to none for a SPA, this would be worth confirming as that could cause an Unauthorized error.

Best Regards,
Colin

I have shared the details on an email(DM) with you @colin.coutts. I am still not sure what’s not working inspite of a well laid out tutorial. @masaki did you find any luck resolving this bug (please can you share some links if you have managed to resolve this)

@sagun786 @colin.coutts
Our issue has been solved by the following changes.

before

grant_types:
  - authorization_code
  - implicit
  - refresh_token
  - client_credentials
token_endpoint_auth_method: client_secret_post

after

grant_types:
  - authorization_code
  - implicit
  - refresh_token
token_endpoint_auth_method: none
4 Likes

Perfect you have eventually figured it out and thanks for sharing with the rest of community!

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