1

我有一个使用 Box sdk 的 Android 应用程序。Box 功能已经中断了一段时间,因为我终于开始更新到最新版本的 sdk。当我尝试使用我的应用程序对用户进行身份验证时,OAuthActivity我被告知“错误:redirect_uri_missing”。

当我在 Box 开发人员页面上查看我的应用程序时,我看到它希望我在 OAuth2 参数部分输入重定向 uri。但是,尽管在寻找答案,但我对在这里输入什么感到非常困惑?

编辑:

基于下面的 API,我似乎可以使用下面的方法在没有设置重定向 uri 的情况下对 box 进行身份验证。但是,当我按如下方式使用它时,我得到:“错误:insecure_redirect_uri”。

OAuthActivity.createOAuthActivityIntent(activity, KEY, SECRET, false, "http://localhost");

/**
     * Create intent to launch OAuthActivity. Notes about redirect url parameter: If you already set redirect url in <a
     * href="https://cloud.app.box.com/developers/services">box dev console</a>, you should pass in the same redirect url or use null for redirect url. If you
     * didn't set it in box dev console, you should pass in a url. In case you don't have a redirect server you can simply use "http://localhost".
     * 
     * @param context
     *            context
     * @param clientId
     *            your box client id
     * @param clientSecret
     *            your box client secret
     * @param allowShowRedirectPage
     *            Whether you want to load/show redirected page after OAuth flow is done.
     * @param redirectUrl
     *            redirect url, if you already set redirect url in <a href="https://cloud.app.box.com/developers/services">box dev console</a>, leave this null
     *            or use the same url, otherwise this field is required. You can use "http://localhost" if you don't have a redirect server.
     * @return
     */
    public static Intent createOAuthActivityIntent(final Context context, final String clientId, final String clientSecret,
        final boolean allowShowRedirectPage, String redirectUrl)
4

2 回答 2

2

很抱歉造成混淆,其中一些文档已过时。您应该https://localhost在应用程序配置页面(可在此处找到)上用作重定向 URI。我们不再允许不安全的重定向 URI,这意味着它们必须使用 HTTPS。为您的应用设置重定向 URI 后,您可以将redirectUrl参数保留为空。

于 2014-12-10T02:19:39.143 回答
0

可以输入http://127.0.0.1https://127.0.0.1(环回地址)

于 2014-12-08T11:55:44.657 回答