Ssswift
Ssswift

Reputation: 1027

How do I create a Google Oauth2 client_id that doesn't just return "Forbidden"?

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:

  1. enabled all the APIs that seemed like they might be relevant to this test (getting my name and user info): "Google Drive API", "Contacts API", "People API", "Google IAM API", etc.
  2. created a "project" for my application
  3. created a new "OAuth client ID" (credentials) for my app

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:

How did p2/OAuth2 create a client_id for Google that works? Why is mine only returning "Forbidden"?

Upvotes: 2

Views: 438

Answers (1)

Divya
Divya

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

Related Questions