Microsoft Graph Toolkit Bug?

Kotynia, Dawid DAKOT 1 Reputation point
2021-12-15T09:43:14.603+00:00

Hi, I'm trying to use Microsoft Graph Toolkit components. I create a simple server with IIS using https://github.com/msusdev/example-static-js-app web page example. Then I try to use https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js [version 2.3.1] library on my page but unfortunatelly on Edge and Chrome it's reporting an error inside the library. It's touching a line 61 and 62:

    function addScript(src, onload) {  
    // TODO: support async loading  
    var tag = document.createElement('script');  
    tag.src = src;  
  
    // if (onload) {  
    //   tag.addEventListener("load", onload);  
    // }  
  
    document.write(tag.outerHTML);  
    // document.head.appendChild(tag);  
  }  
})();  

it's poining I shall not use document.write command. When I copy the content of this library locally and comment this line and uncomment next line with document.head.appendChild(tag) it's wroking. What I'm doing wrong here that I have this problem when refering to this library?

The next problem is when I'm trying to use login component from https://mgt.dev/?path=/story/components-mgt-login--login

The component is visible on my side, I can see it's properly performing the authentication procedure, but finally the component do not change the appearance and login procedure finish with some msal errors pointing to response_type undefined or not proper type. I turn on in azure AD->Authentication ID tokens and Access tokens and check that all values are correct in the manifest. After authentication procedure is finish I'm getting the error as you can see on the picture attached. 157810-4.png

157883-erorrs2.png

The funny thing that authentication is passing when using private microsoft account, but not company account. CORS is switched off so do not ask for that:) The manual methods of calling login procedure from MSAL library https://unpkg.com/@azure/msal-browser@2/lib/msal-browser.min.js are working well for both type of accounts: private and company. Any help what is wrong?

Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,906 Reputation points Microsoft Employee Moderator
    2021-12-28T17:39:16.113+00:00

    @Kotynia, Dawid DAKOT
    Thank you for the detailed post and I apologize for the delayed response!

    Based off your error message AADSTS700051: response_type 'token' is not enabled for the application, it looks like you took the correct troubleshooting steps of enabling the Implicit grant and hybrid flows (Access Token and ID Token). However, since you're still running into this issue, I'd recommend double checking the Application ID used within your code, and confirming that the application has Access Tokens and ID Tokens enabled.

    160920-image.png

    I also checked our backend logs using the Correlation ID ...bd0c745755fc and time stamp 2021-12-14 13:55:44Z that was included in the error screenshot, and was able to get the full error message, which I'll share below.

    Error Message:
    The request failed with the following exception: UnsupportedResponseTypeImplicitFlowAccessTokenNotAllowed

    Remediation:
    The application requested an unsupported response type due to the following reasons: response_type 'token' is not enabled for the application. Application owner should go to the Azure portal or call MS Graph to enable the implicit access token grant.

    If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.