AzureAD / passport-azure-ad

The code for Passport Azure AD has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/passport-azure-ad
Other
422 stars 176 forks source link

Authorisation code flow is broken #499

Closed Darth-koder007 closed 4 years ago

Darth-koder007 commented 4 years ago

When I use authorization code flow I get below-mentioned error

"authentication failed due to: In _authCodeFlowHandler: failed to redeem authorization code: {\"statusCode\":401,\"data\":\"{\\\"error\\\":\\\"invalid_client\\\",\\\"error_description\\\":\\\"AADSTS7000215: Invalid client secret is provided.\\\\r\\\\nTrace ID: abcd\\\\r\\\\nCorrelation ID: abcd\\\\r\\\\nTimestamp: 2020-06-27 16:32:16Z\\\",\\\"error_codes\\\":[7000215],\\\"timestamp\\\":\\\"2020-06-27 16:32:16Z\\\",\\\"trace_id\\\":\\\"abcd\\\",\\\"correlation_id\\\":\\\"abcd\\",\\\"error_uri\\\":\\\"https://login.microsoftonline.com/error?code=7000215\\\"}\"}"

Upon investigation, I found that in file "oidcstrategy" at line querystring.stringify messes up my client secret value and when the request is made on this line gives the error shared above

Check the above said behavior on repl.it

When I put my client secret without any modifications directly in the library itself it modifies it and then the request completes successfully.

Darth-koder007 commented 4 years ago

Closing this issue as turned out my client secret had a extra character which was causing this issue which was not part of the actual secret but got added while copying and pasting it around