gpt4 book ai didi

android - 帮助处理来自 Android 的 OAUTH 推特帖子

转载 作者:行者123 更新时间:2023-11-30 04:48:30 25 4
gpt4 key购买 nike

我想使用 https://github.com/brione/Brion-Learns-OAuth用于从 Android 发布 Twitter 状态

但是我在填充这个常量时遇到了问题。去哪里找

public static final String USER_TOKEN 
public static final String USER_SECRET
public static final String REQUEST_TOKEN
public static final String REQUEST_SECRET
private static final Uri CALLBACK_URI

我在推特上创建应用程序,我猜 USER_SECRET 是消费者 secret 。但我不知道其他值。

谢谢

最佳答案

public static final String USER_TOKEN 
public static final String USER_SECRET

User Token 和 User Secret 是在您注册应用程序时由 Twitter 提供的。 (需要启动与 Twitter 的 OAuth 舞蹈)。

public static final String REQUEST_TOKEN
public static final String REQUEST_SECRET

示例应用程序中仅使用了 2 个常量(用作键)来存储您将在 OAuth 舞蹈期间收到的实际请求 token 和 token secret 。

private static final Uri CALLBACK_URI

回调 URI 定义了 twitter 在授权请求后将用户重定向到哪里。如果是 Web 应用程序,这可以是指向您的应用程序的 URL。如果是 Android 应用程序,这可以是任何 URI。

例如,以下 Activity 需要一个类似于 x-oauthflow://callback 的回调 url。

    <activity android:name=".PrepareRequestTokenActivity" android:launchMode="singleTask">>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="x-oauthflow" android:host="callback" />
</intent-filter>
</activity>

有关更多信息,请查看此页面:http://blog.doityourselfandroid.com/2010/11/10/oauth-flow-in-android-app/

关于android - 帮助处理来自 Android 的 OAUTH 推特帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4228489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com