Twitter API:如何创建仅协议的回调URL?

问题描述 投票:0回答:1

在Twitter的Developer Documentation中,我们可以阅读以下内容:

Mobile apps with app-specific protocols must use just the protocol
Example:
    You want to use example://authorize as your callback URL
    Add this to both your Twitter app dashboard and your call to oauth/request_token: example://

但是;在Developer's Dashboard中,我无法输入仅协议的URL或任何以http或https开头的URL。

Twitter's Developer Dashboard

我只希望使用协议URL的原因是为了可以在使用OAuthSwift访问Web API的iOS应用中使用。

有人有什么想法吗?

twitter oauth ios13
1个回答
0
投票
我还没有找到原始问题的答案,但是我确实做得很好。因此,对于可能落在这里的其他人:

位于https://oauthswift.herokuapp.com/callback的Web应用将执行重定向。如果使用URL https://oauthswift.herokuapp.com/callback/target访问该网站,则它将重定向到oauth-swift:// oauth-callback / target。

所以:

    在Twitter控制台中,为应用程序的回调URL输入https://oauthswift.herokuapp.com/callback/SomeName
  1. 在iOS应用的URL类型中将oauth-swift注册为URL方案
  2. 在您的iOS应用中,使用https://oauthswift.herokuapp.com/callback/SomeName作为OAuth授权请求的回调URL。
  • Voila。 Twitter将重定向到https://oauthswift.herokuapp.com/callback/twitter,这又将重定向到oauth-swift:// oauth-callback / twitter,使您的iOS应用可以重新控制流量。
  • © www.soinside.com 2019 - 2024. All rights reserved.