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

TypeError when acquiring token for scopes #1254

Closed
2 tasks done
ranjanmicrosoft opened this issue Jan 29, 2020 · 1 comment
Closed
2 tasks done

TypeError when acquiring token for scopes #1254

ranjanmicrosoft opened this issue Jan 29, 2020 · 1 comment
Assignees
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-angular Related to @azure/msal-angular package

Comments

@ranjanmicrosoft
Copy link

ranjanmicrosoft commented Jan 29, 2020

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

  • msal@1.2.1
  • @azure/msal-angular@1.0.0-beta.1

Description

Received the following error when trying to get token for graph API.

Error when acquiring token for scopes: user.read TypeError: Cannot read property 'extraQueryParameters' of null

Regression

I haven't successfully used MSAL yet.

Configuration

    MsalModule.forRoot({
        auth: {
            clientId: this.config.clientId,
            authority: 'https://login.microsoftonline.com/' + this.config.tenantId,
            redirectUri: window.location.origin,
            validateAuthority : true,
            postLogoutRedirectUri: window.location.origin,
            navigateToLoginRequestUrl : true
        },
        cache: {
            cacheLocation : 'sessionStorage',
            storeAuthStateInCookie: false
        },
        system: {
            logger: new Logger(
                // tslint:disable-next-line:no-console
                (level: LogLevel, error: string) => { console.log('MSAL LOGGING: ' + level + ' ' + error); } , 
                {
                    level: LogLevel.Verbose,
                    piiLoggingEnabled: false,
                    correlationId: '1234'
                })
        },
        framework: {
            isAngular: true,
            protectedResourceMap: new Map([['https://graph.microsoft.com/v1.0/me', ['user.read']]])
        }
    }, {
        consentScopes: [ 'user.read', 'user_impersonation' ],
        extraQueryParameters: null,
        popUp: true // todo: configure redirect
    }),

Expected behavior

Current behavior is as such from verbose logs:
MSAL LOGGING: 3 Wed, 29 Jan 2020 18:03:54 GMT:1234-1.2.1-Verbose Url: https://graph.microsoft.com/v1.0/me/photo/$value maps to scopes: user.read
MSAL LOGGING: 3 Wed, 29 Jan 2020 18:03:54 GMT:1234-1.2.1-Verbose ADAL's idToken exists. Extracting login information from ADAL's idToken
MSAL LOGGING: 0 Wed, 29 Jan 2020 18:03:54 GMT:1234-1.2.1-Error Error when acquiring token for scopes: user.read TypeError: Cannot read property 'extraQueryParameters' of null

I'd expect the token to be retrieved properly. I didn't have extraQueryParameters set at all in the config, but tried setting it to various values to see if it fixed the issue without success. also didn't have consent scopes set and have tried setting it to various things.

@ranjanmicrosoft ranjanmicrosoft added the bug A problem that needs to be fixed for the feature to function as intended. label Jan 29, 2020
@jasonnutter jasonnutter self-assigned this Jan 29, 2020
@jasonnutter jasonnutter added the msal-angular Related to @azure/msal-angular package label Jan 29, 2020
@jasonnutter
Copy link
Contributor

This will be solved by addressing #1411, closing.

Porges added a commit to Porges/microsoft-authentication-library-for-js that referenced this issue Apr 22, 2020
This addresses AzureAD#1411, AzureAD#1237, and AzureAD#1254. I don’t know why some of these type errors are passing compilation as they should be breaking it?

Untested, edited code in browser window.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-angular Related to @azure/msal-angular package
Projects
None yet
Development

No branches or pull requests

2 participants