potmat / homebridge-google-nest-sdm

A Homebridge plugin for Google Nest devices that uses the Google Smart Device Management API. Supports Cameras, Doorbells, Displays, and Thermostats. Includes support for HomeKit Secure Video.
ISC License
140 stars 17 forks source link

Link Account Fails "Error 400: redirect_uri_mismatch" #66

Closed Asher- closed 1 year ago

Asher- commented 1 year ago

I created Google Cloud project, created a device access project using OAuth credentials from Google Cloud project.

I then used this url from README: https://nestservices.google.com/partnerconnections/project-id/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=oauth2-client-id&response_type=code&scope=https://www.googleapis.com/auth/sdm.service+https://www.googleapis.com/auth/pubsub, substituting device project ID for "project-id " and cloud project oath client ID for "oauth2-client-id".

Attempting to use the url asks me to select account (I select the account corresponding to the project in Google cloud) and then asks me to check which features will be enabled. Upon submitting this form, I receive Error 400: redirect_uri_mismatch.

How do I make this work?

psdl-dev commented 1 year ago

Hi,

you have to set the Authorized-redirect-URI to "https://www.google.com" in your OAuth 2.0-Client-IDs settings.

Asher- commented 1 year ago

No... You set it to https://www.google.com:

You should instead use this URL:

https://nestservices.google.com/partnerconnections/project-id/auth?redirect_uri=https://www.google.com&access_type=offline&prompt=consent&client_id=oauth2-client-id&response_type=code&scope=https://www.googleapis.com/auth/sdm.service+https://www.googleapis.com/auth/pubsub

Perhaps you left out an instruction about changing it to something else?

psdl-dev commented 1 year ago

Are you answering yourself ?

I meant this:

Screenshot 2023-02-06 033101

Asher- commented 1 year ago

Thank you.

For anyone reading this later, this is the credentials subpage of the API section on Google Cloud, after a "web application" oauth client has been created.

gvinter commented 1 year ago

@Asher- @potmat - So the "Authorized Redirect URI" should be set to "https://google.com" for the client ID?