继续得到这个错误,我得到了正确的重定向URI、clientId、clientSecret、grant_type和范围。我尝试过作为表单数据,在正文中,作为url查询参数,但我始终得到完全相同的错误。我得到了正确的代码,我尝试刷新它,但没有效果。基本url是https://login.microsoftonline.com/common/oauth2/v2.0/token。
res = wrapped_post(
MS_BASE,
headers={"Content-Type": "application/x-www-form-urlencoded"},
params = {
"redirect_uri": "http://localhost/",
"client_id": clientId,
"scope": "Files.ReadWrite offline_access",
},
payload={
"redirect_uri": "http://localhost/",
"client_id": clientId,
"scope": "Files.ReadWrite offline_access",
"grant_type": "authorization_code",
"code": code,
"client_secret": client_secret
},
)这是一个示例请求。我尝试使用files=代替有效负载(用于表单数据),没有任何查询参数,所有查询参数等等。wrapped_post只是一个用于包装requests.post函数的函数,具有相同的kwargs (有效负载而不是body )。
发布于 2022-03-22 11:49:51
grant_type=code需要在params中
https://stackoverflow.com/questions/71570553
复制相似问题