ios - 使用 asana 的 oauth 授权(重定向 url)

标签 ios objective-c oauth authorization asana

我需要在我的应用程序中使用 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 来重定向回我的应用程序(此处和帐户设置中)?或者也许我做错了?

提前致谢。

最佳答案

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

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

相关文章:

ios - 有没有更好的方法来展平 NSDictionaries 的 NSArray?

ios - 在touchesBegan 和touchesEnded 之间是否有调用的方法?

ios - 使用 Swift 将常用方法放在单独的文件中

c - 与 Objective-C/C 中的 GetLastError 类似的功能?

android - InAppPurchase Android 验证问题

objective-c - 如何使用 route-me 创建透明层

ios - PjSip 添加多个 header

objective-c - 在IOS xcode程序中搜索Char数组中的字符串?

使用 OAuth 访问 token 的 GitHub 克隆

php - 无法使用php表单在google oauth上交换 token 的授权码