gpt4 book ai didi

ios - 为什么在尝试登录 Box 时出现重定向 URI 不匹配?

转载 作者:可可西里 更新时间:2023-11-01 05:04:26 26 4
gpt4 key购买 nike

使用 Box SDK for iOS 时要执行 OAuth,我会看到一个包含此错误的网页:

enter image description here

Error: redirect_uri_mismatch

response_type=code redirect_uri=boxsdk-our4iypzazstfpx8j70e8tlc3eyn9c4l://boxsdkoauth2redirect state=ok client_id=our4iypzazstfpx8j70e8tlc3eyn9c4l

我使用了他们建议的代码:

[self
presentViewController:[[BoxAuthorizationViewController alloc]
initWithAuthorizationURL:[[BoxSDK sharedSDK].OAuth2Session authorizeURL]
redirectURI:nil
]
animated:YES
completion:nil
];

我的客户端 ID 和客户端密码是在此之前设置的。在我的 info.plist 文件中,我将 boxsdk-our4iypzazstfpx8j70e8tlc3eyn9c4l 作为 URL 方案。我无法遵循的唯一说明是:

Note: When setting up your service on Box, leave the OAuth2 reditrect URI blank. The SDK will provide a custom redirect URI when issuing OAuth2 calls; doing so requires that no redirect URI be set in your service settings.

当我尝试将重定向 URI 留空并在开发人员控制台中保存表单时,出现此错误:

OAuth2 redirect URL must specify a valid URL and must not be http://

所以我不得不输入一些东西。我输入了“https://mydomain.com”(我的真实域名)。我修改了 iOS 代码以将该 URI 传递到 BoxAuthorizationViewController,但我仍然收到相同的错误网页。

最佳答案

抱歉,这是我们文档中的一个错误。如果您在开发人员控制台中为您的 redirect_uri 输入 boxsdk-YOUR_CLIENT_ID://boxsdkoauth2redirect,将 YOUR_CLIENT_ID 替换为您的实际客户端 ID,它应该可以工作。

关于ios - 为什么在尝试登录 Box 时出现重定向 URI 不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25024693/

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