使用体式的oauth授权(重定向网址)

时间:2013-12-10 19:52:19

标签: ios objective-c oauth authorization 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(此处和帐户设置)重定向回我的应用程序?或者也许我做错了?

提前致谢。

1 个答案:

答案 0 :(得分:1)

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

相关问题