aspnetcore-connect-sample icon indicating copy to clipboard operation
aspnetcore-connect-sample copied to clipboard

Single tenant - Guest Account login error - Null Token

Open anujabhojani opened this issue 4 years ago • 1 comments

  1. Updated the GraphAuthProvider.cs for supporting single tenant. _app = ConfidentialClientApplicationBuilder.Create(azureOptions.ClientId) .WithClientSecret(azureOptions.ClientSecret) .WithTenantId(azureOptions.TenantId) .WithAuthority(AzureCloudInstance.AzurePublic, AadAuthorityAudience.AzureAdMyOrg) .WithRedirectUri(azureOptions.BaseUrl + azureOptions.CallbackPath) .Build(); Azure App updated for Single Tenant: image

  2. From Azure Portal, Invited the Guest User. image

  3. Tried to login with Guest account, login url goes into loop. Debugging shows that getting the null in var account = await _app.GetAccountAsync(userId);

image

image

Any help to solve this issue?

anujabhojani avatar Jun 15 '20 12:06 anujabhojani

I was able to repro the issue. The problem is, that the guest user's token is cached, but the identifier consists of the guest user's original oid and tenant id. In contrast, when we are getting the account, we are trying to do that with the guest tenant's tenant id and the guest oid of the guest user (users get new oids when they join an external AD). And that's why account is null.

@jmprieur do you have any info about this? How should this case be handled?

mark-szabo avatar Jul 16 '20 12:07 mark-szabo

Closing issue as we are archiving this repository.

jasonjoh avatar Apr 12 '23 13:04 jasonjoh