0

I am trying to use Google as an identity provider in an ADB2C SignInSignUp userflow, consumed within a React Native app through a WebView.

When I am testing this I am hitting an error that I cannot seem to find the cause of. Upon signing up with google I receive the following response object:

{"canGoBack": true, "canGoForward": false, "loading": false, "target": 99, "title": "Loading...", "url": "https://TENANT.b2clogin.com/TENANT.onmicrosoft.com/oauth2/authresp?state=StateProperties%3DeyJTSUQiOiJ4LW1zLWNwaW0tcmM6NjIxMDMyYTYtZTVlZC00OTJkLTg1NmMtMTAzYzg3Mzc0YmE3IiwiVElEIjoiZDM5ZTgwY2MtNzJlNy00ZGE5LWJjODYtMGRjZGNlN2Q1MDZlIiwiVE9JRCI6IjRkOTkyMzhiLTBhOGEtNGU0Ny1hYTRkLTk5NTZiYTY3NmE5YyJ9&code=4%2F0AX4XfWhrpKK2DDX58pFTHkb_U2e8SvGnLrPvhI4grUn5ojA5R-q7q4KjcdS1tO4DYemuWQ&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&authuser=0&prompt=none#"}

Typically I would receive the fully formatted token back in this response, which I then use for server side validation. This works when signing up with Apple and as a B2C user when pressing 'Sign up now' on the userflow.

The token returned in this is not formatted correctly and doesn't follow 'code=' in the response url as I usually get when signing in or up through the other methods, and therefore throws an error of :'AADB2C90090: The provided JWE is not a valid 5 segment token.' when trying to parse what follows StateProperties.

Does anybody know why Google would not return a valid token in the same way that Apple/Microsoft do when signing up?

Any help would be greatly appreciated

  • We are parsing the code param, and trading it for a token server side. There’s something wrong when google responds with the exchange of the code for a token. Do you have a correlationId? – Jas Suri - MSFT Jun 12 '22 at 14:44

1 Answers1

0

Please check few workarounds:

  1. Try to include client id in scope along with other scopes 2.Try mentionin Response_mode=form_post in auth request
  2. In some cases its working with other versions , so try Msal version 4.32. see Issue · GitHub According to sign-in with a Google account - Azure AD B2C | Microsoft Docs make sure to create app registered in google’s console

Also note from the same document and this blog:

enter image description here

References:

  1. jwt - Azure AD B2C - Token validation does not work - Stack Overflow
  2. Azure Active Directory B2C - Authorization code encoding issue (microsoft.com)
kavyaS
  • 8,026
  • 1
  • 7
  • 19