greghesp / assistant-relay

A Node.js server that allows for sending commands to Google Home/Assistant from endpoints
GNU General Public License v2.0
781 stars 224 forks source link

Getting metadata from plugin failed with error: invalid_grant #222

Open HeedfulCrayon opened 3 years ago

HeedfulCrayon commented 3 years ago

Describe the bug Assistan relay seems to lose auth after a while. Whenever testing anything in sandbox I get this error: Getting metadata from plugin failed with error: invalid_grant

To Reproduce Steps to reproduce the behavior: Try any command in sandbox

Expected behavior Command or broadcast to occur without issue.

Desktop (please complete the following information):

matteskonto commented 3 years ago

I have it running now for 10 days without issue after I made the apps in Production status for two users (one project each)

jayhohoho2019 commented 3 years ago

Did you get an unverified app message from Google when adding the user?

matteskonto commented 3 years ago

Not anymore, I still get the 100 logins limit when creating a new OAuth client

jesselumarie commented 3 years ago

mine still seems to be working too (it was off for a few days, as my kid apparently unplugged my raspberry pi 😅), but after starting up the server again it's working without having to redo my credentials.

craigmcgowan commented 3 years ago

Getting the same issue, thankfully resolved by resetting my user as suggested above. Look forward to a full time fix

jayhohoho2019 commented 3 years ago

You are still getting this issue even after publishing the app?

craigmcgowan commented 3 years ago

Ill try that. I had thought that I saw a comment saying it didnt work so I never tried it. Have just published it now. Thank you

Snacker001 commented 3 years ago

At the risk of tempting fate, 11 days on and still working. In case it makes any difference this is the first time it has been "reactivated" post publishing the app, rather than publishing it after authenticating last time. Fingers crossed

jesselumarie commented 3 years ago

Mine is still working, nearly two weeks after publishing

pickonedev commented 3 years ago

solved

This addon was not updated for almost half of Year... What can you ask more to work? Nothing! The addon it is almost dead...

henning334 commented 3 years ago

So by way of update, a week on and having published on the developer console it has fallen over again. A quick remove and re-add user with the same client_secret and back up.

Interestingly, I also have a similar issue with Nest, again on almost a weekly basis it fails and needs re-authenticating via the integrations pain. Looking into that it seems there are issues where google invalidates the tokens:

https://github.com/home-assistant/core/issues/44584

https://developers.google.com/identity/protocols/oauth2#expiration

Is it still working for you after publishing it again?

I'm pretty new to GAR, and noticed in the last few days that it stopped working. Found i get the same error "UNAVAILABLE: Getting metadata from plugin failed with error: invalid_grant" as you guys are.

Will try to publish the app, but i'm not certain thats a permanent fix. If it is, i suggest install guides/instructions are updated with this info.

jonathanbower commented 3 years ago

Publishing the app is not a solution. Mine just failed after about three weeks.

Snacker001 commented 3 years ago

Mine is still working fine post publishing 20 days ago.

craigmcgowan commented 3 years ago

Mine has failed since publishing 9 days ago too.

ryancasler commented 3 years ago

Yours has failed or has not failed?

I'm pretty sure I said that pushing to production was the solution back in January if I'm not mistaken. I have screenshots from the setup and I'll put a step-by-step together for the future.

craigmcgowan commented 3 years ago

Yes mine has failed. I published around 11 days ago.and already again I get the invalid grant error.

jayhohoho2019 commented 3 years ago

Mine has been working since Jan 25th. Here are my observations from a previous post: Fyi yesterday after I published the app (so its status became In Production) in the developer console, I also got the new verification status which is Verification Not Required. After that when I added a new user, I no longer got the Unverified App warning.

I think if you don't get the unverified app warning when you add a new user you should be fine.

rocker01 commented 3 years ago

I've been facing this issue regularly too. Have v3.2.0 running on a Raspberry Pi 4 (4GB model), and after a few days I start getting this error message. The only solution to this has been to either reinstall Assistant Relay or remove and re-add my user.

I appreciate all the work that must have gone into creating this project, and it is honestly incredible - the only this that is keeping it from greatness is this annoying bug!

drinfernoo commented 3 years ago

I can confirm I'm also seeing this same behavior in 3.2.0:

/root/.pm2/logs/www-error.log last 15 lines:
0|www      |   details: 'Getting metadata from plugin failed with error: invalid_grant'
0|www      | }
0|www      | Auth error:Error: invalid_grant
0|www      | Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: invalid_grant
0|www      |     at Object.exports.createStatusError (/assistant_relay/node_modules/grpc/src/common.js:91:15)
0|www      |     at ClientDuplexStream._emitStatusIfDone (/assistant_relay/node_modules/grpc/src/client.js:233:26)
0|www      |     at ClientDuplexStream._receiveStatus (/assistant_relay/node_modules/grpc/src/client.js:211:8)
0|www      |     at Object.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:1311:15)
0|www      |     at InterceptingListener._callNext (/assistant_relay/node_modules/grpc/src/client_interceptors.js:568:42)
0|www      |     at InterceptingListener.onReceiveStatus (/assistant_relay/node_modules/grpc/src/client_interceptors.js:618:8)
0|www      |     at /assistant_relay/node_modules/grpc/src/client_interceptors.js:1127:18 {
0|www      |   code: 14,
0|www      |   metadata: Metadata { _internal_repr: {}, flags: 0 },
0|www      |   details: 'Getting metadata from plugin failed with error: invalid_grant'
0|www      | }

This happens after a few days, and when I try to broadcast (via an HA automation), I still get the "broadcast chime" noise playing, but then nothing is spoken. Deleting the user and re-adding it (even with the same credentials) does seem to work for awhile, as others have said.

lazdavila commented 3 years ago

Update. Still working for me after 8+ days. It always expired in 7 days or sooner before. What I did was I published the app in the developer console (status showing In Production). Verification status is Verification Not Required. I didn't get the Unverified App warning after this, when I added a new user. Notice this: if your users are seeing the "unverified app" screen , it is because your OAuth request includes additional scopes that haven't been approved.

... just in case anyone else is also having problems figuring out how to 'publish' the app (took me ages to find it), it is under: https://console.cloud.google.com/apis/credentials/consent, in the "Publishing Status" section. After doing this, I also removed and re-added the user in the relay site, and confirmed that I did not get the "Unverified App" warning.

dotrooster commented 2 years ago

I wasn't sure if I should start a new thread or just tack onto this one since my issue is related. Sorry if I'm in the wrong place.

I've been having the same invalid_grant issue as everyone else, but when I try to publish the app and then re-create the user in RA, I get an "Error 400: invalid_request: message where I should be seeing an option to login to my google account. Specifically, the probelm is apparently with "redirect_uri: urn:ietf:wg:oauth:2.0:oob". Anyone know where I'm going wrong?

Thanks!

techtom609 commented 2 years ago

I wasn't sure if I should start a new thread or just tack onto this one since my issue is related. Sorry if I'm in the wrong place.

I've been having the same invalid_grant issue as everyone else, but when I try to publish the app and then re-create the user in RA, I get an "Error 400: invalid_request: message where I should be seeing an option to login to my google account. Specifically, the probelm is apparently with "redirect_uri: urn:ietf:wg:oauth:2.0:oob". Anyone know where I'm going wrong?

Thanks!

Im running into this same exact issue. I have tried absolutely everything but cannot get passed this error. Any ideas?

jiffyjaff commented 2 years ago

Your issue is the same as what I've reported here.

https://github.com/greghesp/assistant-relay/issues/266

techtom609 commented 2 years ago

Thank you so much for the update!!

On Wed, Mar 9, 2022 at 12:23 AM Jeff Toth @.***> wrote:

Your issue is the same as what I've reported here.

266 https://github.com/greghesp/assistant-relay/issues/266

— Reply to this email directly, view it on GitHub https://github.com/greghesp/assistant-relay/issues/222#issuecomment-1062566492, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO4Q7MBXLCQFCKWUBYIUJYTU7AYWXANCNFSM4VJP46MQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>