Reputation: 1513
I want to have a script for getting home feed of Google+. I use for that google's script. The client-secrets.json file is:
{
"web": {
"client_id": "##########",
"client_secret": "############",
"redirect_uris": ["http://localhost:8080/oauth2callback/"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"client_email":"##########@developer.gserviceaccount.com",
"javascript_origins":["http://localhost:8080/"]
}
}
But when i want to start this app, it opens a page with error and broken robot:
The redirect URI in the request: http://localhost:8080/ did not match a registered redirect URI
Please, help me with my problem.
Upvotes: 3
Views: 2078
Reputation: 10972
Running local server on port 80 and making config URLs simply http://localhost
fixed it for me.
e.g. for your case
{
"web": {
"client_id": "##########",
"client_secret": "############",
"redirect_uris": ["http://localhost/oauth2callback/"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"client_email":"##########@developer.gserviceaccount.com",
"javascript_origins":["http://localhost"]
}
}
Upvotes: 0
Reputation: 1513
I found the solution! You should create another Client ID, but for desktop application! After that you need to use it's client_id and client_secret. It works for developing without hosting.
Upvotes: 11
Reputation: 10163
The values you have used for client_id
and client_secret
correspond to a Google APIs Project that you have created and will access via
https://code.google.com/apis/console/?pli=1#project:XYZ
where XYZ
is your project ID.
In this project, you'll need to make sure that http://localhost:8080/
is a redirect URI by
http://localhost:8080/
to the "Authorized Redirect URIs" boxUpvotes: 1