CALLBACK与oath2 foursquare

时间:2011-11-18 15:17:25

标签: android api callback foursquare

我创建了一个活动,它将打开浏览器以询问您是否允许该应用程序。 这里没什么奇怪的,但是当API将我重定向到回调时,会给我回复此错误:

fis://test.com?error=redirect_uri_mismatch

为什么?!

这是我打开浏览器的代码:

Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("https://foursquare.com/oauth2/authenticate"
            + "?client_id=" + Utils.FOURSQUARE_CLIENT_ID
            + "&response_type=code" + "&redirect_uri=fis://test.com"));
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP
                            | Intent.FLAG_ACTIVITY_NO_HISTORY
                            | Intent.FLAG_FROM_BACKGROUND);
    startActivity(intent);

这很奇怪,因为重定向正在运行,但错误显示redirect_url_mismatch

1 个答案:

答案 0 :(得分:2)

您需要确保您在foursquare(https://foursquare.com/oauth)的客户端设置中指定的重定向网址与您正在使用的重定向网址完全相同,包括协议。