1

I have used AppAuth iOS for access Google Drive, 10 days ago, everything worked fine, I could fetch files from my drive normally. But today, (I have not changed code for 10 days) I can not fetch files, it's having this issue:

Error Domain=org.openid.appauth.oauth_token Code=-10 "invalid_grant: Bad Request" UserInfo={OIDOAuthErrorResponseErrorKey={ error = "invalid_grant"; "error_description" = "Bad Request"; }, NSUnderlyingError=0x600000d1cdb0 {Error Domain=org.openid.appauth.remote-http Code=400 "{ "error": "invalid_grant", "error_description": "Bad Request" }" UserInfo={NSLocalizedDescription={ "error": "invalid_grant", "error_description": "Bad Request" }}}, request=<NSMutableURLRequest: 0x6000003cdbf0> { 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: Bad Request}

Does anyone have any solution for this issue?

TylerP
  • 9,600
  • 4
  • 39
  • 43
Minh Văn
  • 51
  • 1
  • 4
  • 1
    Hi @Minh Văn, it would be good to include a piece of the source code you're using to access google drive so others can help you find the issue. – odm Apr 28 '20 at 00:35
  • I just forgot to assign auth state for GTLRDriveService.[solve] – Minh Văn Apr 29 '20 at 03:08
  • Check the "Authorization scopes" if you are adding right scope. – RoHaN Jun 21 '20 at 13:52

2 Answers2

0

now google drive have change in there api's i also faced same issue i fixed like Now i am sending a header like this for getting the files

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

it definitely work !!!!

Anil Kumar
  • 1,830
  • 15
  • 24
0

P/s: this is my code to make request and authorizing

ketaki Damale
  • 634
  • 7
  • 25
Minh Văn
  • 51
  • 1
  • 4