Azure-Samples / Azure-Samples/ms-identity-ciam-dotnet-tutorial

Redirect back to Android App Not working fully

Open
#143 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
48
Forks
35
PR merge metrics
No merged PRs in 30d

Description

I built this example with .NET 10 preview and on android after authentication which is valid it pops up a dialog to select from apps.

https://github.com/Azure-Samples/ms-identity-ciam-dotnet-tutorial/tree/main/1-Authentication/2-sign-in-maui

The only changes I made to the sample are the client id. The updatemsal.ps1 is a script that updates the msal from appsetttings.json.

![Image](https://github.com/user-attachments/assets/cf92e2b2-0512-4307-99e4-d046c1955d77)

![Image](https://github.com/user-attachments/assets/02c30884-4741-405c-955c-a8245be282b6)

Using an older method for MSAL I don't see this problem. After I click sign in on this image it goes straight back to the app. This older method is using policy based method I believe.

AuthenticationResult result = await PCAWrapperB2C.Instance.AcquireTokenInteractiveAsync(B2CConstants.Scopes);

private PCAWrapperB2C()
{
// Create PCA once. Make sure that all the config parameters below are passed
PCA = PublicClientApplicationBuilder
.Create(B2CConstants.ClientID)
.WithExperimentalFeatures() // this is for upcoming logger
.WithLogging(_logger)

.WithB2CAuthority(B2CConstants.AuthoritySignInSignUp)
.WithIosKeychainSecurityGroup(B2CConstants.IOSKeyChainGroup)
.WithRedirectUri(B2CConstants.RedirectUri)
.Build();
}

public static string Tenant = "MyNextbook.onmicrosoft.com";
public static string AzureADB2CHostname = "MyNextbook.b2clogin.com";

public static string ClientID = "b3f22bxxx...";

public static readonly string RedirectUri = $"msal{ClientID}://auth";

public static string PolicySignUpSignIn = "B2C_1_MNB_SignInSignUp";

public static string[] Scopes = {
"https://MyNextBook.onmicrosoft.com/api/user_impersonation"
};

public static readonly string AuthorityBase = $"https://{AzureADB2CHostname}/tfp/{Tenant}/";
public static readonly string AuthoritySignInSignUp = $"{AuthorityBase}{PolicySignUpSignIn}";
![Image](https://github.com/user-attachments/assets/00d95720-a343-4c53-b6c3-30d7366a2e48)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with 1-Authentication/2-sign-in-maui and inspect the Android sign-in flow, the updatemsal.ps1 script, and the PCAWrapperB2C AcquireTokenInteractiveAsync configuration shown in the report. Reproduce the authentication flow on Android using the current sample and compare it with the older policy-based method. Done means a valid sign-in returns directly to the app without an app-selection dialog.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, azure, csharp, powershell
Domain
authentication, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.