发出AppAuth iOS“ invalid_grant:错误的请求”

时间:2020-04-27 09:09:33

标签: ios google-drive-api appauth

我已经使用AppAuth iOS访问Google云端硬盘了,十天前,一切正常,我可以正常从云端硬盘中获取文件。但是今天,(我已经十天没有更改代码了)我无法获取文件,这是一个问题:

Error Domain = org.openid.appauth.oauth_token代码= -10“ invalid_grant:错误的请求” UserInfo = {OIDOAuthErrorResponseErrorKey = { 错误=“ invalid_grant”; “ error_description” =“错误的请求”; },NSUnderlyingError = 0x600000d1cdb0 {Error Domain = org.openid.appauth.remote-http Code = 400“ { “错误”:“ invalid_grant”, “ error_description”:“错误请求” }“ UserInfo = {NSLocalizedDescription = { “错误”:“ invalid_grant”, “ error_description”:“错误请求” }}},request = {URL:https://www.googleapis.com/drive/v3/files?fields=kind%2C%20nextPageToken%2C%20files%28id%2C%20mimeType%2C%20kind%2C%20name%2C%20webViewLink%2C%20thumbnailLink%2C%20trashed%2C%20parents%2C%20fileExtension%2C%20modifiedTime%2C%20size%29&prettyPrint=false&q=%27root%27%20IN%20parents},NSLocalizedDescription = invalid_grant:错误的请求}

有人对此问题有解决方案吗?

2 个答案:

答案 0 :(得分:0)

现在Google驱动器中的api发生了变化,我也遇到了我修复的相同问题,例如 现在我正在发送这样的标题以获取文件

var dict = ["Content-Type": "application/json"]
dict["Authorization"] = "Bearer " + authClientAccessToken

绝对可以!!!!

答案 1 :(得分:0)

enter image description here P / s: 这是我的请求和授权代码