1

Every once in awhile I get the error "Uncaught (in promise) null" when using MGT and I'm unable to access any of the toolkit components. I refresh the page and the error goes away.

Any reason that this could be happening? I'm guessing that the SDK isn't recognizing the login state? Below is the code where I initialize my provider. Maybe that is the issue?

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://use.typekit.net/ytq8cvk.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

    <script type="text/javascript" src="https://alcdn.msauth.net/browser/2.17.0/js/msal-browser.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@microsoft/microsoft-graph-client/lib/graph-js-sdk.js"></script>

    <script src="/site/global_scripts" type="text/javascript"></script>
    <link href="/site/global_styles" type="text/css" rel="stylesheet">
</head>

<body>
    <script src="https://unpkg.com/@microsoft/mgt/dist/bundle/mgt-loader.js"></script> 
    <mgt-msal2-provider client-id="***" 
            scopes="user.read,people.read"
            ></mgt-msal2-provider>
Ovii
  • 67
  • 7
  • I wonder if the cache is invalidating the login for some reason? Can you post your full code including mgt components used, and the full error on the mgt repo: https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/new/choose We'll be able to help with a bit more info. – Nic Vogt Jan 12 '22 at 19:31
  • https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/1476 Posted! Thank you. – Ovii Jan 12 '22 at 19:57

0 Answers0