microsoft-graph-apimigrationoutlook-restapi

Migrate existing users (and tokens) from Outlook REST API to MS Graph


Hi we have a system that already has a large userbase (100k+) of microsoft users which we push updates to, using the refresh token we have saved during their inital signup.

The REST APi will get deprecated on the 30th of November in favour of the Graph API. https://devblogs.microsoft.com/microsoft365dev/outlook-rest-api-v2-0-deprecation-notice

I have upgraded all API calls to the new graph api but am faced with the following error: CompactToken parsing failed with error code: 8004920A

From further digging it seems like it is caused since the tokens are not interchangable between the two APIs: https://learn.microsoft.com/en-us/answers/questions/1010061/migration-from-rest-to-graph-refreshed-token-throw.html

So is there a way to port these users into the new API without having them to go through the oauth flow again, since we don't have a functionality to request this from the users?


Solution

  • We were calling the token flow without the scope parameter, which was working fine with the DEPRECATED API. But with the new Graph API, we had to add the relevant scope query param, and the returned token worked with the new API calls. Hope this helps someone.