Search code examples
azureoauth-2.0azure-active-directoryexchangewebservices

AcquireTokenAsync: What Kind of Token is being returned?


The version of the AcquireTokenAsync constructor I use returns a Security Token

I noticed some other versions of this constructor return an Access Token

After reading around, I still haven't found the difference. What is the difference?


Solution

  • The version of AcquireTokenAsync method that you have mentioned in your question returns Access Token. So there is no difference.

    Notice the Returns section in the same documentation that you have linked in question.

    enter image description here

    After your call to AcquireToken is done, you should be able to get the access token from result using the direct property named AccessToken like result.AccessToken

    You can also verify this by trying to decode the token that you get back using https://jwt.ms

    Access tokens enable clients to securely call APIs protected by Azure. Generally the client that acquires the token should treat it as an opaque string, because it's contents are meant for the actual resource API that the client is trying to access.

    You can read more about Access Tokens and the claims inside here on Microsoft Docs