Reputation: 13
When making an outlook api https://outlook.office.com/api/v2.0/me/photo/$value call for getting photos through Postman/ajax call. Getting the below error.
{"error":{"code":"UnknownTokenType","message":"Token type is not known.","innerError":{"requestId":"df42ad59-d446-48a6-bfbe-6a9334bde364","date":"2019-08-09T08:06:24"}}}
Able to get the oauth 2.0 access token and pass it to the header of the outlook api call. The call returns 401 unauthorized status with the error message UnknownTokenType.
GET /api/v2.0/me/photo/$value HTTP/1.1
Host: outlook.office.com
Authorization: Bearer eyJ0eX..
User-Agent: PostmanRuntime/7.15.2
Accept: */*
Cache-Control: no-cache
Postman-Token: 53ee..
Host: outlook.office.com
Accept-Encoding: gzip, deflate
Connection: keep-alive
cache-control: no-cache
Could someone help with the error code? I believe the token type is Bearer which is already passed with the access token
Thanks in advance.
Upvotes: 1
Views: 1025
Reputation: 4640
There are two ways to access Microsoft products in the cloud these days. There is the original API for each product such as Outlook, Sharepoint etc but you can increasingly use the Microsoft Graph API to access each product through a common API format.
Are you getting the access token with a Graph scope:
https://graph.microsoft.com/.default
and then passing that to the Outlook API? That could produce the error you're seeing as each API has its own access token scope. This shows how to use the Graph API to access Outlook with the appropriate scopes.
When I access the Sharepoint API directly I need to scope the access token differently from when I access the Sharepoint API through the Graph API.
Upvotes: 2