Reputation: 3219
I used the MSAL library for Android by referring the implementation : Azure AD B2C Sample but I don't see the login page. I did entered the correct details in Constants file
public final static String TENANT = "eventsapp.onmicrosoft.com";
public final static String CLIENT_ID = "XXXX-XXXX-XXXX-XXXX-XXXXXXX";
public final static String SISU_POLICY = "B2C_1_signin"; // my SISU policy name
public final static String EDIT_PROFILE_POLICY = "B2C_1_edit_profile";
public final static String AUTHORITY = "https://myapp.b2clogin.com/tfp/" + TENANT + "/" + SISU_POLICY; // myapp is a placeholder
And in Main Activity :
private String[] SCOPES = {"user.read"};
PublicClientApplication publicClientApplication = new PublicClientApplication(
this.getApplicationContext(),
Constants.CLIENT_ID,
Constants.AUTHORITY);
publicClientApplication.acquireToken((Activity) context, SCOPES, getAuthInteractiveCallback());
Added libs in build.gradle :
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.microsoft.identity.client:msal:0.3.+'
Where requesting for token all I see is a blank page. I copied the URL and pasted in browser and it gives nothing. But when tested using the user flow in Azure portal it works.
Any help please ?
Upvotes: 1
Views: 782
Reputation: 11335
User.Read
is in an invalid scope for AAD B2C, its referring to Graph API. So the page is likely just throwing an error back to the app, hence the customer doesn't see it.
They need to follow the following, which creates an App Reg to represent a resource (web api), and then publish a scope on this App Reg. Then on the Android App Reg, they need to add the scope to its permissions:
Then in the app, this
private String[] SCOPES = {"user.read"};
Should look like this instead
private String[] SCOPES = {"https://contosotenant.onmicrosoft.com/api/permissionName"};
Upvotes: 1