错误:尝试在 Onedrive 中获取访问令牌时,公共客户端无法发送客户端机密 [英] Error: Public clients can't send a client secret while try to get access token in Onedrive

查看:306
本文介绍了错误:尝试在 Onedrive 中获取访问令牌时,公共客户端无法发送客户端机密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下 URL 获取 OneDrive 访问令牌

I am trying to get OneDrive access token by following URL

https://login.live.com/oauth20_token.srf?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&redirect_uri=https://login.live.com/oauth20_codesk=AUTHORIZATION_CODE&grant_type=authorization_code

但响应如下

{"error":"invalid_request","error_description":"公共客户端无法发送客户端密钥."}

{"error":"invalid_request","error_description":"Public clients can't send a client secret."}

谁能解释一下?

推荐答案

公共客户端"是移动或桌面应用程序(Web 服务是机密客户端").MSA 给您这个回复是因为您正在重定向到 https://login.live.com/oauth20_desktop.srf.在这种情况下,您不应在请求中提供 client_secret 值,因此您的请求应如下所示:

A "public client" is a mobile or desktop application (web services are "confidential clients"). MSA is giving you this response because you're redirecting to https://login.live.com/oauth20_desktop.srf. In this case, you should not be providing the client_secret value in the request, so your request should just look like this:

https://login.live.com/oauth20_token.srf?client_id=YOUR_CLIENT_ID&redirect_uri=https://login.live.com/oauth20_desktop.srf&code=AUTHORIZATION_CODE&grant_type=authorization_code

这篇关于错误:尝试在 Onedrive 中获取访问令牌时,公共客户端无法发送客户端机密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆