endoplasmic / google-assistant

A node.js implementation of the Google Assistant SDK
MIT License
284 stars 75 forks source link

Unable to process request due to missing initial state. This may happen if browser sessionStorage is inaccessible or accidentally cleared. #98

Open Roaders opened 3 years ago

Roaders commented 3 years ago

Hi

I am trying to get the console-input.js example working. I have setup my google console project, have downloaded the key file and have run my app:

image

I then get the Google Account sign in page where I pick my account and then various confirmation pages:

image

image

image

But then rather than a code I get:

image

Unable to process request due to missing initial state. This may happen if browser sessionStorage is inaccessible or accidentally cleared.

I've tried to figure out what the issue is and there are some bugs reported about this. It seems related to domain registration. I can't see any domains that are used so I am not sure what if anything should be registered.

Is this an issue with my setup or has Google changed the configuration? It looked like the app process setup has changed a bit since your readme (and in fact Google help pages) were written. For example in the Set activity controls for your account the Device Information and Voice & Audio Activity switches were not present on the page that opens so I was unable to turn them on.

Roaders commented 3 years ago

BTW - this is chrome and I have not set any extra privacy settings or restricting local storage access or anything like that.

Roaders commented 3 years ago

...and I also tested with Edge to get the same issue

endoplasmic commented 3 years ago

What is the Firebase app doing in this scenario? It seems like it's missing some sort of configuration? I just tried the example and it seems to be working fine for me.

Roaders commented 3 years ago

I didn't do anything with firebase. That is from the default setting created by google when I setup a new project.

endoplasmic commented 3 years ago

I know this is a bit old, but did you end up figuring out your issue @Roaders?

Roaders commented 3 years ago

No. I followed the instructions as closely as I could (some of the setup options were slightly different from what was described) and I was left with that error.

skamath99 commented 2 years ago

@endoplasmic I'm getting the same exact error! Pretty new to firebase and OAuth, not sure how to resolve this. Is there a specific configuration or setup I'm supposed to use with Firebase?

For OAuth2 I'm using the default "Web client (auto created by Google Service)" where the: Authorized URIs:

Authorized redirect URIs

marcussacana commented 1 year ago

I solved with a strange process. 1 - Enabled the oauth authorized redirect uri to: http://localhost:5754/auth/handler 2 - Restarted Google Assistent, and Clicked in the "Browser Didn't open" button after try login 3 - Copied the Auth url, look like this: https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&scope=...&response_type=code&client_id=...&redirect_uri= 4 - In the end of this url, has a redirect_uri parameter, I modified that parameter to http%3A%2F%2Flocalhost%3A5754%2Fauth%2Fhandler 5 - Press Ctrl + Shift + I in the Google Assistent to open the Inspector 6 - Go to Network tab to enable the network debugging 7 - Continue the login in your browser 8 - After auth, the google assistent will look like everything is right, and will begin a 10 seconds cooldown. 9 - You will see in the Network tab a request to '/token' that has a error response, click in that 10 - Go to "initializator" tab of that request, look for the first 'request' function call and click it 11 - A javascript code will open, put a breakpoint with F2 12 - Press "Retry" in the Google Assistent to try login again 13 - In the your browser login success message, back the page 2 times and login more one time 14 - The debugger will stop the code, now go to console and run this command: opts.data = opts.body = opts.body.replace("uri=https", "uri=http"); 15 - If didn't displayed any error, back to the Sources tab and click in "Resume" in the debugger menu 16 - Just wait and see the magic :)

Dear god, that was a trouble.