Android:OAuth Microsoft云健康API中未返回刷新令牌

时间:2015-09-02 15:53:47

标签: android oauth oauth-2.0 microsoft-band

使用我的凭据点击Microsoft band的登录URL后,我被重定向到包含访问令牌的URL,但它不会返回授权范围的刷新令牌(offline_access)。我们是否必须在Microsoft帐户中进行任何更改以进行脱机访问?

注意:重定向网址中缺少offline_access范围

登录网址:(获取访问令牌)

https://login.live.com/oauth20_authorize.srf?client_id=0000000067E8E&scope=offline_access mshealth.ReadDevices mshealth.ReadActivityHistory& response_type = token &安培; REDIRECT_URI = https://login.live.com/oauth20_desktop.srf

重定向网址

https://login.live.com/oauth20_desktop.srf?lc=1033#access_token=EwCgAvF0BAAUkWhN6f8bO0%2bg89MA1fmZueWyRkQAAe%2bPpQEZi2ny0/0knttDAVbenK3VDVzYzmD7HRVQ2rZXp9hSbJE1VvXse%2bZW0IoWqVvgAdHmWleOmKHhB3E4eJ220ztjozrqyxA0Vo/T1/RzW8U2f%2b5FQp6YKnPCXPIOenPz9XqHBapvzZkRTXO666VuJ7cjgcmQ7ANIJyMdu6J1DmEmp5B2pbLlRf/RxGFDzQEuhdHE68ExKtdRgXNGquW9fwKx6uG4Np6tCHebbzOUoY8/oHLS7x/eNUPYJUKMJweljI3FVOBUnaiYfMSY/AUFBvPvjrIoyQIjTmEG81vn3jIbhUVOuC/BTAZcm0aW3tZQLor9TLmd/uDg/P5jPZsDZgAACKznE0lStQmJcAFKavrO1/U7NXE1zzCSj2MHf867kmZ62UNwUmOqfbBHbFmFaNyqLq5d7Brv/RuIKV321t8OEcE8jUp65D9rjTp3jSYWnKP2mwib%2bvOpdtctN41yoCr%2bk8gKcyALtB%2bYbpxAFrN5J471XLzXy0doOCbOmjbU%2bYKy1mZI/j%2b0Hvn7JSL9B3DC1/YqfF21OjjzT8Xtil5Av/kVCpr8KIYpfzxVP4YqavxU1xriw2c4hR1uN%2b9dp4NuurxpeJb%2boUJ9LgikZN3rX2iB4n5e5VxtH0jRPujZd0nTRA8kwhJJzlgrIGsBDoqEDp8xp9KqkUEZ7%2bevvhbRD/9O5x6/4g%2biPORgicWqTEQ4XxvV5LKaeZq4rKxaDemmNI92yHjSjYA2WQNidbjEmRmelA221Sn2AFqp77uOD7%2bTitoXzOPWMrqLjGkcOH9UQdYA9uXbSPvQ7g1AwUPtlB7Y2fh0JlzBa7OyGrzai9mHJ1jmyXRj76/naI0B&token_type=bearer&expires_in=3600&scope=mshealth.readactivityhistory%20mshealth.readdevices&user_id=2c6adaf29f64fe0d0d72670f90c67080

1 个答案:

答案 0 :(得分:1)

您尝试使用' response_type = token'但Microsoft Health API使用两步' response_type = code'认证流程。请参阅Getting Started指南的第4.8节。第一个调用的重定向URL包含授权代码作为查询参数。您在第二次调用中使用该代码,该调用返回包含访问令牌的JSON响应主体和(如果请求了offline_access范围)刷新令牌。