title: InvalidAuthenticationToken - CompactToken parsing failed with error code: -2147184105
body: <p>I am using V1 in order to have a token from Microsoft REST API. (We have Office 365 tenant and I used to successfully get all resources without any problem but not anymore.</p>
  
  <pre class="lang-http prettyprint-override"><code>clientId =8a67......de4b6
  clientSecret =J58k8....5EU=
  redirectUri =http://example.com...
  resourceUrl =https://graph.microsoft.com
  authority = https://login.microsoftonline.com/f02633....a603/oauth2/token
  </code></pre>
  
  <p><code>https://login.microsoftonline.com/f0263...0be3/oauth2/authorize?client_id=8a6..b6&amp;redirect_uri=http://example.com&amp;response_type=code&amp;scope=mail.read</code></p>
  
  <p>It gave me a token structured as <a href="https://w68i.imgup.net/ScreenShot29e8.png" rel="nofollow noreferrer">follows</a> on <a href="https://jwt.io/" rel="nofollow noreferrer">JWT</a>. It says invalid signature but not sure what is wrong.</p>
  
  <p>Once I have the token, I tried the following curl call </p>
  
  <pre><code>curl -i https://graph.microsoft.com/v1.0/me/messages -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Barer eyJ.[TOKEN]...UNa6nfw'
  </code></pre>
  
  <p>Instead of the messages, I received the following error:</p>
  
  <pre class="lang-http prettyprint-override"><code>HTTP/1.1 401 Unauthorized
  Content-Type: application/json; charset=utf-8Cl23
  Server: Microsoft-IIS/8.5
  request-id: af2390b1-a9b...5ab9
  client-request-id: af2390,....a615ab9
  x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"West US","Slice":"SliceA","ScaleUnit":"000","Host":"AGSFE_IN_4","ADSiteName":"WST"}}
  X-Powered-By: ASP.NET
  Date: Thu, 19 Jan 2017 23:55:43 GMT
  Content-Length: 268
  
  {
    "error": {
      "code": "InvalidAuthenticationToken",
      "message": "CompactToken parsing failed with error code: -2147184105",
      "innerError": {
        "request-id": "af2390b1-...5ab9",
        "date": "2017-01-19T23:55:44"
      }
    }
  } 
  </code></pre>
  
  <p>I looked at similar questions on SO but couldn't find any solution.</p>