GoDaddy redirect from office365 not returning refresh token
Asked Answered
P

1

2

I have an app which syncs to OneDrive. If the user is using Office365 via GoDaddy and I have a grant_type of 'refresh_token', it doesn't return the refresh_token back, which in turn, won't let me refresh the token I currently have. I've tried adding access_type="offline" and prompt="consent" when doing a POST request to no avail. Help?

Here's my code:

credentials = OpenStruct.new
params = {
      client_id: client_credentials[:key],
      redirect_uri: redirect_url,
      client_secret: client_credentials[:secret],
      refresh_token: refresh_token,
      grant_type: 'refresh_token',
      resource: resource_id,
      access_type: 'offline',
      prompt: 'consent'
} 
RestClient.post(client.token_url, params) # doesn't return refresh_token
Promoter answered 9/9, 2016 at 0:42 Comment(1)
Possible duplicate of Refresh token not returned for Office365 accounts purchased through GoDaddyRillings
P
0

Based on the request, it seems you were refresh the token. Based on the OAuth 2.0 code grant flow, there is no parameter about access_type and prompt. You can refer below for the support parameter:

enter image description here

And here is the post for your reference:

POST /{tenant}/oauth2/token HTTP/1.1
Host: https://login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded

client_id=6731de76-14a6-49ae-97bc-6eba6914391e
&refresh_token=OAAABAAAAiL9Kn2Z27UubvWFPbm0gLWQJVzCTE9UkP3pSx1aXxUjq...
&grant_type=refresh_token
&resource=https%3A%2F%2Fservice.contoso.com%2F
&client_secret=JqQX2PNo9bpM0uEihUPzyrh 
Prostyle answered 12/9, 2016 at 2:46 Comment(1)
thanks for your reply. Without those two parameters, it still not giving me back a refresh_token. What happens is that if I post it and it doesn't redirect to godaddy, it gives me back a refresh_token. But when it does a redirect to godaddy, it doesn't give me back the refresh_token.Promoter

© 2022 - 2024 — McMap. All rights reserved.