【问题标题】:401 error code when using Soundcloud API OAuth2使用 Soundcloud API OAuth2 时出现 401 错误代码
【发布时间】:2011-06-30 10:16:46
【问题描述】:

我正在使用 Soundcloud 附带的 TestApp 应用程序创建一个 iPhone 应用程序 Coca API 包装器下载。

当我使用密钥和客户端 ID 并回调 URL 时,没有 问题。我可以使用我的 Soundcloud 帐户登录应用程序并上传 只需按一下按钮即可查看我的曲目。

当我将客户端 ID、密钥和回调 URL 切换到我想要的 已在我的开发者帐户中列出了行为更改。我可以登录 并且该应用程序已注册到我的帐户,但在我的用户名之前 发布到应用程序中,我在代码中的此级别得到 401

 - (void)connectionDidFinishLoading:(NSURLConnection *)connection; 
{ 
#if (NXOAuth2ConnectionDebug) 

    NSLog(@"%.0fms (SUCC) - %@", -[startDate 
timeIntervalSinceNow]*1000.0, [self descriptionForRequest:request]); 

#endif 
    printf("connectionDidFinishLoading\n");

        if (sendConnectionDidEndNotification) [[NSNotificationCenter 
defaultCenter] postNotificationName:NXOAuth2DidEndConnection 
object:self]; 

        sendConnectionDidEndNotification = NO; 

    printf("connectDidFinishLoading.1\n"); 
    printf("self.statusCode:   %d \n", self.statusCode); 

因为我的应用程序与密钥、ID 和回调 URL 完美配合 在 TestApp 中给出,当我切换这些时,我感到很奇怪 我得到 401 的值。

只是为了进一步澄清:

这是一个 iOS 应用程序,我确定放置了正确的密钥和 ID 在正确的位置。来自 souncloud.com 的客户端 ID 和 Secret(不是 sandbox-soundcloud) 直接插入到下面的值中

#ifdef kUseProduction

在我看来这是正确的做法。另外,在我的 info.plist 文件中 我有网址标识符

com.imc 

和 URL 方案

http://imc 

与 Soundcloud 提交的重定向 URI 完全匹配。

同样,我将 kCallbackURL 定义为

http://imc

还有其他想法吗?

【问题讨论】:

    标签: iphone web-services http oauth soundcloud


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-05
      • 1970-01-01
      • 2012-05-12
      • 2016-01-10
      • 1970-01-01
      • 2014-02-15
      • 2012-07-19
      相关资源
      最近更新 更多