【问题标题】:invalid_grant when using grant type "authorization_code"使用授权类型“authorization_code”时的 invalid_grant
【发布时间】:2015-01-08 03:40:08
【问题描述】:

您好,我在尝试使用“authorization_code”的授权类型时收到“invalid_grant”错误。

这是我用于 OAuth2 授权端点的 url: https://soundcloud.com/connect?client_id=myClientId&redirect_uri=http://www.bing.com&response_type=code&scope=non-expiring

这是我的 OAuth2 令牌端点的消息正文:

Dictionary<string, string> messageBody = new Dictionary<string, string>();
messageBody.Add("client_id", clientId);
messageBody.Add("client_secret", clientSecret);
messageBody.Add("redirect_uri", "http://www.bing.com");
messageBody.Add("grant_type", "authorization_code");
messageBody.Add("code", code);

非常感谢任何帮助!

【问题讨论】:

    标签: c# soundcloud


    【解决方案1】:

    设法对其进行排序!将第一个 URL 中的 response_type 更改为“token”而不是“code”会生成一个可用于后续请求的令牌。您甚至不需要使用 access_code 进行第二个帖子部分,因为您已经有了一个令牌!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-24
      • 2019-01-24
      • 2019-10-17
      • 2020-08-06
      • 1970-01-01
      • 2016-10-17
      • 2019-12-07
      • 1970-01-01
      相关资源
      最近更新 更多