Migrating from OAuth1 to OAuth2

时光总嘲笑我的痴心妄想 提交于 2019-12-12 23:17:25

问题


We have an existing application on SoundCloud that was created some time ago and set up to use OAuth1. Recently we needed to expand SoundCloud-related functionality and, because of some problems with the old library, had to upgrade to new cocoa-api-wrapper library that uses OAuth2 client.

The problem now is that we cannot access our application with its key/secret because of the different version of OAuth. While it is possible to set up new application and get new key/secret pair, we wouldn't want to lose all the data associated with the current application.

Is there a way to have the same SoundCloud application accessible with both versions of OAuth (OAuth1 is still being used)? If not, what's the best way to handle this situation?


回答1:


Yes. You can migrate an OAuth1 token to an OAuth2 token by sending a POST request to the following endpoint:

https://api.soundcloud.com/oauth2/token

with the following parameters:

  • client_id='YOUR_CLIENT_ID'
  • client_secret='YOUR_CLIENT_SECRET'
  • grant_type='oauth1_token'
  • refresh_token='OAUTH1_TOKEN'

The response will contain an OAuth2 token (as well as expires_in, scope, refresh_token).



来源:https://stackoverflow.com/questions/15303023/migrating-from-oauth1-to-oauth2

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