angular-auth-oidc-client icon indicating copy to clipboard operation
angular-auth-oidc-client copied to clipboard

Token endpoint errors not reported correctly

Open CobusKruger opened this issue 5 years ago • 3 comments

Describe the bug When the token endpoint comes back with an error, the library reports the error as ERROR OidcService code request https://sts.example.com/ with error [object Object]. Obviously, it would be much more beneficial to have the actual object content, but the entire object gets interpolated. This happens in two places:

In refreshTokensRequestTokens

const errorMessage = `OidcService code request ${this.configurationProvider.openIDConfiguration.stsServer}: ${error}`;

And in codeFlowCodeRequest

const errorMessage = `OidcService code request ${this.configurationProvider.openIDConfiguration.stsServer} with error ${error}`;

To Reproduce I'm not sure how to reliably reproduce this, but if you tamper with the code in the callback URL, that ought to do it.

Expected behavior Exactly the same error, but with the error message returned from the server intact. For example, when my token request failed, I received the following object from IdentityServer: { "error": "invalid_grant" }. Either include the JSON for the object, or report the error itself. The message should read something like this: ERROR OidcService code request https://sts.example.com/ with error { "error": "invalid_grant" }

Screenshots If applicable, add screenshots to help explain your problem. image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 83.0.4103.97

Additional context I'll be happy to make this change if you need a contributor.

CobusKruger avatar Jun 29 '20 07:06 CobusKruger

Hey @CobusKruger , I have seen that as well, a think to target during the next releases. If you could do a PR we would be very happy. Thanks!

FabianGosebrink avatar Jun 30 '20 18:06 FabianGosebrink

This is still a problem in V14.1.2.

This is what I get back: OidcService code request https://localhost:44301 Error: [object Object]

JohnGalt1717 avatar Aug 03 '22 18:08 JohnGalt1717

I will have a look at this.

FabianGosebrink avatar Aug 03 '22 19:08 FabianGosebrink

Released.

FabianGosebrink avatar Aug 06 '22 07:08 FabianGosebrink

Hi! I'm using version 14.1.5 and still facing the same issue image

kenanaReda avatar Oct 09 '22 14:10 kenanaReda

@kenanaReda Did you already overcome that error? If yes, could you provide the steps you went through. I am currently experiencing the same issue on my app.

frk93 avatar Jan 29 '23 20:01 frk93

Could you update to V15?

FabianGosebrink avatar Jan 30 '23 06:01 FabianGosebrink

@FabianGosebrink I am on version 15.0.2

frk93 avatar Jan 30 '23 15:01 frk93

@frk93 Unfortunately I couldn't fix it, and even couldn't specify the scenario to get the issue, It was showing suddenly.

kenanaReda avatar Jan 30 '23 15:01 kenanaReda