Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph permissions consent window after upgrading to TeamsFX 2.4.0 in multi-tenant app #10701

Closed
robertstewartnz opened this issue Jan 17, 2024 · 3 comments
Assignees
Labels
investigating needs attention This issue needs the attention of a contributor. TA:Auth Team Area: Auth

Comments

@robertstewartnz
Copy link

Hi there,

We have upgraded using the latest code snippets and Nuget packages Microsoft.TeamsFX 2.4.0, Microsoft.Graph 5.38.0. But I am getting a weird issue when I go to pop up the user consent for Graph permissions. Instead of opening the permissions window it is opening the another instance of the app where the permissions consent should be.

I have a multi tenant app so have configured GetOnBehalfOfCredential() like this. Using "common" instead of my TenantId.

public async Task<OnBehalfOfCredential> GetOnBehalfOfCredential()
{           
            AccessToken ssoToken = await _teamsUserCredential.GetTokenAsync(new TokenRequestContext(null), new CancellationToken());
            
            return new OnBehalfOfCredential("common",
                Configuration.ClientId,
                Configuration.ClientSecret,
                ssoToken.Token
            );
}

In ConsentAndShow. The call to await _teamsUserCredential.LoginAsync(scope); is causing another instance of the app open, not the permissions window.

public async Task<bool> ConsentAndShow(string[] scope)
{
    try
    {
        await _teamsUserCredential.LoginAsync(scope);

        return true;
    }....

If I use an Admin account to grant consent in Azure Identity everything is fine, but I want to have the flexibility for users to consent too. Have you seen this behaviour?

@robertstewartnz
Copy link
Author

I'm using Visual Studio 2022 Version 17.7.4

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs attention This issue needs the attention of a contributor. label Jan 17, 2024
@KennethBWSong
Copy link
Contributor

Hi @robertstewartnz Thank you for using our Toolkit! Would you please help to verify "InitiateLoginEndpoint" in "./appsettings.json" or "./appsettings.develop.json" is correctly set to your login start page? You can simple open this url in browser and see whether this page will ask you to login.

@robertstewartnz
Copy link
Author

@KennethBWSong Thanks. I just worked that out 5 minutes ago. Thanks this was the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating needs attention This issue needs the attention of a contributor. TA:Auth Team Area: Auth
Projects
None yet
Development

No branches or pull requests

3 participants