【问题标题】:SoundCloud - 401 Unauthorized Error - Authenticating without the SoundCloud Connect ScreenSoundCloud - 401 未经授权的错误 - 在没有 SoundCloud 连接屏幕的情况下进行身份验证
【发布时间】:2012-06-20 09:18:52
【问题描述】:

我是 SoundCloud 的新手,一直在关注 Authenticating without SoundCloud screen 中的开发人员文档。

但是,当我的应用程序发送请求时,我收到 401 Unauthorized 错误。在文档中,它指定检查 client_id 或 access_token 是否丢失。

我无法弄清楚这里有什么问题。我检查了以下内容:

  1. 注册申请 - 检查
  2. 传递 client_id 和 client_secret - 检查

这是我调用声音云服务器的代码:

response = (HttpWebResponse)request.GetResponse();

这里是请求对象的值:

AuthenticationLevel     MutualAuthRequested
CachePolicy                {Level:BypassCache}
ConnectionGroupName null
内容长度            -1
ContentType                 “应用程序/json”
凭据                    null
标头                        {Content-Type: application/json}
ImpersonationLevel       委托
方法                          “POST”
预认证              false
代理                            {System.Net.WebRequest.WebProxyWrapper}
RequestUri                    {https://api.soundcloud.com/oauth2/token?client_id=############&client_secret=###########&grant_type=password&username=### ####&密码=########}
超时                         100000
UseDefaultCredentials   false

通话后我收到 401 Unauthorized 错误,我什至尝试关注 Geek Life's 博客但收到相同的错误。 我在这里遗漏了什么吗?

【问题讨论】:

  • 亲爱的你能剪下你的代码吗?我正在尝试使用 c# 连接到 soundcloud,但不知道该怎么做

标签: c#-4.0 oauth-2.0 soundcloud


【解决方案1】:

我认为这里的问题是您在请求的查询字符串中发送客户端凭据。您必须改为在请求正文中发送它们。

【讨论】:

  • 感谢您朝正确的方向轻推。将参数添加到消息正文中,将内容类型更改为“application/x-www-form-urlencoded”并收到一个令牌:)
猜你喜欢
  • 1970-01-01
  • 2021-09-28
  • 1970-01-01
  • 2013-04-02
  • 2013-08-09
  • 1970-01-01
  • 2018-07-09
  • 2014-04-29
  • 1970-01-01
相关资源
最近更新 更多