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

Id = 14, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}" #215

Open
psdongre313 opened this issue Feb 13, 2019 · 2 comments

Comments

@psdongre313
Copy link

I am trying to get AAD access token from Azure and i am getting WaitingForActivation message.. Am i doing something wrong.. Please help ... Thanks in Advance !!

public static async Task getAcccessTockenMs( string certificateLocation, string certificatePassword)
{
// AAD Instance
string authority = "https://login.microsoftonline.com/{Tanent ID}";

        string clientId = "Client Application ID";
        string aadAudience = "https://login.microsoftonline.com/{Tanent ID}/oauth2/token";

        var authCtx = new AuthenticationContext(authority);
        // Load certificate from Disk
        X509Certificate2 clientCert = new X509Certificate2(certificateLocation, certificatePassword);
        
        var clientAssertion = new ClientAssertionCertificate(clientId, clientCert);

        var authenticationResult = await authCtx.AcquireTokenAsync(aadAudience, clientAssertion);

        if (authenticationResult == null)
        {
            throw new InvalidOperationException("Failed to obtain the token");
        }
        // contains the token
        string accessToken = authenticationResult.AccessToken;
        return accessToken;
    }
@UmutComlekci
Copy link

You need to use await keyword for async methods. You see this message because of Task doesn't run yet.

@teengineer
Copy link

You need to use await keyword for async methods. You see this message because of Task doesn't run yet.

thanks, i used it and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants