从 OAuth1 迁移到 OAuth2 [英] Migrating from OAuth1 to OAuth2

查看:71
本文介绍了从 OAuth1 迁移到 OAuth2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 SoundCloud 上有一个应用程序,它是前一段时间创建的并设置为使用 OAuth1.最近我们需要扩展 SoundCloud 相关的功能,由于旧库的一些问题,不得不升级到使用 OAuth2 客户端的新 cocoa-api-wrapper 库.

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.

现在的问题是,由于 OAuth 版本不同,我们无法使用其密钥/秘密访问我们的应用程序.虽然可以设置新应用程序并获得新的密钥/秘密对,但我们不希望丢失与当前应用程序相关的所有数据.

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.

有没有办法让两个版本的 OAuth(仍在使用 OAuth1)访问相同的 SoundCloud 应用程序?如果没有,处理这种情况的最佳方法是什么?

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?

推荐答案

是的.您可以通过向以下端点发送 POST 请求,将 OAuth1 令牌迁移到 OAuth2 令牌:

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

具有以下参数:

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

响应将包含 OAuth2 令牌(以及 expires_inscoperefresh_token).

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

这篇关于从 OAuth1 迁移到 OAuth2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆