Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use native Google Account Picker with B2C

This is more an Azure B2C question than a flutter/android question:

TLDR: How can I get a B2C JWT token 'eyJhbGciO...' with a Google access token 'ya29.Glss...'?

We are building an app with flutter that uses Azure B2C to manage the users. While this works fine with simple_auth, we are not huge fans of the whole 'browser popup navigation'/chrome custom tab and we would love to use the native google sign in plugin that shows the local google accounts and allows us to get an access and id token from google (the tokens start with 'ya29.Glss...'. But what are we supposed to do with these two tokens afterwards? I assume I'll have to post it to some custom policy/endpoint somewhere on B2C to receive a B2C token (starting with 'eyJhbGciO...') or do I need to request the token from google with some other parameters?

Any help would be appreciated. Cheers

like image 910
Chief Wiggum Avatar asked Jun 19 '19 09:06

Chief Wiggum


2 Answers

You can create a resource owner password credential (ROPC) flow that enables a native app to collect a user credential and exchange it for an ID token, an access token, and a refresh token with the Azure AD B2C tenant.

These Android and iOS samples demonstrate how you can integrate an Android or iOS app and the ROPC flow using the AppAuth SDKs.

like image 168
Chris Padgett Avatar answered Nov 11 '22 13:11

Chris Padgett


It seems the scenario you are trying might not work with B2C or any other Identity products, You can try the below link to integrate B2C in android with opensource package.

https://azure.microsoft.com/en-in/resources/samples/active-directory-b2c-android-native-appauth/

like image 2
MA0608 Avatar answered Nov 11 '22 13:11

MA0608