Microsoft_graph oAuth update error

I am allowing users to authorize their Microsoft accounts using oAuth and the Microsoft Charting API. I am using this omniauth strategy to make authorization easier. In the OmniAuth strategy, it includes a resource for authorize_params

and token_params

" https://graph.microsoft.com ". This allows me to authenticate just fine, but when I go to update auth I get this error:

{"error"=>"unauthorized_client", "error_description"=>"AADSTS70001: Resource 'https://graph.microsoft.com/' is not supported as resource.\r\n"}

      

Along with trace_id and some other stuff I'll post if needed.

The endpoint I am pushing to update, POST https://login.microsoftonline.com/common/oauth2/v2.0/token

with options client_id

, refresh_token

and grant_type: "refresh_token"

.

Updating this oAuth token worked fine as far back as last week. Has anything changed with the Microsoft Graph APIs?

+3


source to share


2 answers


You can take a look at Refresh token .

It looks like you were partially there, you were just missing some additional options:

  • grant_type - Set as refresh_token

  • refresh_token is the refresh token value that you received from the Provider.
  • client_id is your app id from above
  • client_secret is the password we created before
  • area - This should match the same set of areas you first requested.
  • redirect_uri is the redirect URI defined in your app registration.


They are formatted application/x-www-form-urlencoded

in your POST beforehttps://login.microsoftonline.com/common/oauth2/v2.0/token

POST URL: https://login.microsoftonline.com/common/oauth2/v2.0/token
POST HEADER: Content-Type: application/x-www-form-urlencoded
POST BODY: grant_type=refresh_token&refresh_token=[REFRESH TOKEN]
           &client_id=[APPLICATION ID]&client_secret=[PASSWORD]
           &scope=[SCOPE]&redirect_uri=[REDIRECT URI]

      

+2


source


Turns out it was as easy as I was in authing mode before v1.0

, but tried to repeat it for now v2.0

. Not sure why this worked so far, but ensuring they end up in the same API version fixed the issue.



0


source







All Articles