mikejac/node-red-contrib-google-smarthome

Log message: redirect_uri ... invalid

Closed this issue · 3 comments

I've followed the guide and ensured I have the correct project id in my JWT.

I'm not sure how else to debug this, but I'm unable to pass the local check.

When trying to connect with the google home app I get the user authentication login but then get "Could not reach.."

Any ideas?

I'm facing same issue.
@daleye do you resolved this issue?

Oh, I'm so sorry. I have totally overlooked this issue.

"redirect_uri ... invalid" means either the project id in your JWT file is wrong. Or Google tries connect with an invalid redirect URL

Can you please enable debugging in config node. Then try to login in the app. Depending on when exactly it breaks there should be log messages like this:

2023-02-04T21:27:34.927213547Z HttpAuth:httpAuthRegister(GET /oauth) query {"response_type":"code","client_id":"XXXXX","redirect_uri":"https://oauth-redirect.googleusercontent.com/r/demoproject","state":"XXXXX"}

or

2023-02-04T21:27:53.169897143Z HttpAuth:httpAuthRegister(POST /oauth): body = {"username":"XXXXX","password":"XXXXX","client_id":"XXXXX","redirect_uri":"https://oauth-redirect.googleusercontent.com/r/demoproject","state":"XXXXX","response_type":"","id_token":""}

or

2023-02-04T21:27:54.163696708Z HttpAuth:httpAuthRegister(/token): body = {"grant_type":"authorization_code","code":"XXXXX","redirect_uri":"https://oauth-redirect.googleusercontent.com/r/demoproject","client_id":"XXXXX","client_secret":"XXXXX"}

For comparison, a complete list of all log messages expected during login can be found here.

The interesting part in the log messages is the redirect_uri. It should be https://oauth-redirect.googleusercontent.com/r/<project_id>. project_id is the id as given in the JWT key file.

Closing this now. Feel free to reopen if neccessary.