GoDaddy redirect from office365 not returning refresh token

ε祈祈猫儿з 提交于 2019-12-14 03:57:10

问题


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

回答1:


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:

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 


来源:https://stackoverflow.com/questions/39402163/godaddy-redirect-from-office365-not-returning-refresh-token

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!