title: How can i check if the token passed to a POST command is authorized?
body: <p>My application is in angular 8 using MSAL v2.0.
  The app asks for user's office 365 credentials, logs them in and then allows them to create an event in their calendar.
  The user is successfully logged, a token is acquired but when trying to create an event in calendar using MS Graph Rest API, the system throws a 401 Unauthorized error.</p>
  <p>The login function below returns a login success message when user logs in. The accessToken value is null but the idToken has a value. Should the accessToken have a value? Also, is the 401 error because scope is needed in the loginPopup command?:</p>
  <pre><code>loginPopup(request) {
          return super.loginPopup(request)
              .then((authResponse) =&gt; 
              this.broadcastService.broadcast(&quot;msal:loginSuccess&quot;, authResponse);
              return authResponse;
          })
              .catch((error) =&gt; {
              this.broadcastService.broadcast(&quot;msal:loginFailure&quot;, error);
              this.getLogger().error(&quot;Error during login:\n&quot; + error.errorMessage);
              throw error;
          });
      }
  </code></pre>
  <p>The error message is:
  zone-evergreen.js:1042 &quot;POST <a href="https://graph.microsoft.com/v1.0/me/events" rel="nofollow noreferrer">https://graph.microsoft.com/v1.0/me/events</a> 401 (Unauthorized)&quot;</p>
  <p>Clicking on the link <a href="https://graph.microsoft.com/v1.0/me/events" rel="nofollow noreferrer">https://graph.microsoft.com/v1.0/me/events</a> in this error message shows:
  <a href="https://login.microsoftonline.com/" rel="nofollow noreferrer">https://login.microsoftonline.com/</a>/oauth2/v2.0/authorize?response_type=id_token&amp;scope=openid%20profile&amp;client_id=&amp;redirect_uri=https%3A%2F%2FmyApp.abc.com%2F&amp;state=%3D&amp;nonce=ad9d4ce5-7676-5515-a36c-7b2b3c70d366&amp;client_info=1&amp;x-client-SKU=MSAL.JS&amp;x-client-Ver=1.4.2&amp;login_hint=sales1%40abc.com&amp;client-request-id=&amp;response_mode=fragment&amp;sso_reload=true</p>