user1540471
user1540471

Reputation: 431

Google drive : redirect_uri_mismatch

I followed this basic tutorial, but I get:

Eroare:redirect_uri_mismatch The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob did not match a registered redirect URI

In my googlings I understand there is something wrong in some settings I made in API Console. I enabled Drive API and I made some settings in table API Access. I take the Client ID and client secret and I put these 2 values in client source but I do not know what to put in the Redirect URI.

What should contain the Redirect URIs?

Upvotes: 30

Views: 32356

Answers (5)

Theunis Kruger
Theunis Kruger

Reputation: 11

I was struggling with the google Calendar API, exactly the same error , I created a new OAuth 2.0 Cleint ID, and chose Desktop Client, used those .json client secret and it started working

Upvotes: 0

Erisan Olasheni
Erisan Olasheni

Reputation: 2905

When you create the credentials in the APIs Console, select "TV and Limited Input devices", this will allow the urn:ietf:wg:oauth:2.0:oob redirect_uri, once it is authenticated, a code will be display for you to paste in the application.

Upvotes: 3

Claudio Cherubino
Claudio Cherubino

Reputation: 15024

The URI urn:ietf:wg:oauth:2.0:oob is a special URI used to identify out-of-browser applications, i.e. non-web applications (desktop, mobile, command line, etc.).

When you create the credentials in the APIs Console, make sure you select "Installed Application" as the application type and the redirect URI will automatically be set as urn:ietf:wg:oauth:2.0:oob and prevent the "redirect_uri_mismatch" when making a request.

Upvotes: 39

Jayaprada
Jayaprada

Reputation: 954

The URI

urn:ietf:wg:oauth:2.0:oob

is only applicable to those Google client IDs that have been generated for "installed applications".

So to solve your problem you have to create a new Client ID and set Application Type as "Installed application". There you can get ClientId and ClientSecret which you will need.

  1. Create a new Project Here

  2. Select APIs from the left side bar and make sure Drive SDK is ON

  3. Go to Credientials below APIs ,tap on "CREATE NEW CLIENT ID"

  4. Select Installed application and type as iOS and provide Bundle ID (or simply choose "Other")

  5. Copy Client ID & Client secret to use that in your application.

The redirect URI is automatically generated and should prevent the error you are getting.

Upvotes: 8

ashora
ashora

Reputation: 7

For those web applications,please define the URI as your php url as it can handle the token and operate google drive.

Upvotes: -2

Related Questions