OGeek|极客世界-中国程序员成长平台

标题: ios - 使用 asana 的 oauth 授权(重定向 url) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 17:08
标题: ios - 使用 asana 的 oauth 授权(重定向 url)

我需要在我的应用中使用 asana 进行授权。我正在使用 OAuth2Client 库进行 oauth 授权。

配置:

    [[NXOAuth2AccountStore sharedStore] setClientID"my_clientID"
                                         secret"my_client_secret"
                               authorizationURL:[NSURL URLWithString"https://app.asana.com/-/oauth_authorize"]
                                       tokenURL:[NSURL URLWithString"https://app.asana.com/-/oauth_token"]
                                    redirectURL:[NSURL URLWithString"http://localhost:3000"]// <-- this is the problem part
                                 forAccountType"myService"];

请求:

[[NXOAuth2AccountStore sharedStore] requestAccessToAccountWithType"myService"];

它通过授权启动 Safari,询问我的权限,然后重定向到 redirectURL。但是我应该使用什么 redirectURL(在此处和帐户设置中)重定向回我的应用程序?或者也许我做错了?

提前致谢。



Best Answer-推荐答案


我建议使用自定义 URI 处理程序,例如“myapp://oauth/asana”,并将您的应用配置为注册到 myapp://(当然,替换 myapp 包含更具体的应用程序)。

关于ios - 使用 asana 的 oauth 授权(重定向 url),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20503915/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4