Reputation: 1027
I'm trying to use p2/OAuth2 to access my documents on Google Drive.
I downloaded the sample Mac app and ran it, and it shows a Google "OAuth consent screen", and I click the "Allow" button, and it all works. So I think the sample code is good.
Then I logged into the Google APIs console, and:
I pasted my client_id into the OAuth2App sample, in place of the demo client_id/client_secret, and it fails. It shows the "OAuth consent screen" in a sheet, with the name of my application, but when I click "Allow", it just says "Forbidden".
Things I've tried that didn't help:
I've found this page which says creating a client ID of type "Other" in Google doesn't work, and I need to choose iOS. I've tried both "Other" and "iOS" types, and both give me "Forbidden".
With type "Other", it gives me a client_secret, as well. I don't want or need that, because this is a local app, but I found this question which suggests it doesn't matter to Google. I tried every way:
So I know it's checking that for type="Other", and doesn't seem to care that it's absent for type="iOS". In any event, since it's a different error when that's wrong/missing, that doesn't seem to be my problem here.
I turned on oauth.verbose
to see if there's anything useful, but the logs are identical to the successful case (stock IDs), except for the values of some of the IDs/tokens.
How did p2/OAuth2 create a client_id for Google that works? Why is mine only returning "Forbidden"?
Upvotes: 2
Views: 438
Reputation: 1213
If it is your Local app, You'll need to select the installed
option while selecting the type, and use Web Athorization Broker
this link might be helpful, its unsolved but has solution for the point you are stuck.
1.) ClientID
and ClientSecret
both are necessary while using installed application.
--> Also check your network rights if it is allowing the Drive api
, that can also give Forbidden Error
Upvotes: 1