java - Android 手机重定向上的 Hunch 身份验证

标签 java android authentication oauth hunch

我正在 Android 手机上进行身份验证,该手机在单击登录按钮后将用户发送到 Hunch 进行身份验证。这将设置一个新的 Intent ,如下所示:

Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri data = Uri.parse("hunch.com/authorize/v1/?app_id=1234&next=hoosheer-hunch-app://");
    intent.setData(data);
    startActivity(intent);

这是我的 list 文件

<activity android:name="hunch" android:label="hunch">
        <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="hoosheer-hunch-app" />
        </intent-filter>
    </activity>

它给我这个错误:

04-12 17:04:22.574: ERROR/AndroidRuntime(838): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=hunch.com/authorize/v1/?app_id=1234&next=hoosheer-hunch-app:// }

但是我有类似的代码用于使用 Foursquare 登录。 hunch.java 类包含一个 onResume 方法

最佳答案

Hunch 目前不支持自定义 URL 方案,例如 hoosheer-hunch-app://

在我们实现此功能之前,您应该使用以下 URL 进行身份验证:

http://hunch.com/authorize/v1/?app_id=1234&next=/

授权您的应用程序后,用户将被重定向到

http://hunch.com/?auth_token_key=4d3d3d3d3&user_id=hn_5678&next=%2F

您应该监视 ACTION_VIEW Intent 的 URL 更改,从 URL 中提取 auth_token_key,然后使用 get-auth-token 将其交换为 auth_token API 调用。

关于java - Android 手机重定向上的 Hunch 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5638575/

相关文章:

java - 排列发生器

java - 时区 java : San Antonio, 得克萨斯州

java - IntelliJ 13.1.6 TestNG 无法打开调试器端口 : java.net.SocketException "Socket closed"

android - 解析 XML 时出错 : Mismatched tag - Android strange error

Java REGEX 模式问题

java - 计算移动平均值的线程安全方法

android - 在 2.2 设备上开发时如何使 AdMob 工作?

php - Laravel:从 android(不是浏览器)询问 "Am I Logged in?"

oracle - Oracle APEX 中的自定义身份验证

Swift:如何实现登录 Storyboard?