Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting a 'Error 400: invalid_request' on first invocation #170

Open
bugok opened this issue Jul 9, 2022 · 7 comments
Open

Getting a 'Error 400: invalid_request' on first invocation #170

bugok opened this issue Jul 9, 2022 · 7 comments
Assignees

Comments

@bugok
Copy link

bugok commented Jul 9, 2022

Following the installation instructions in #95 I was able to get passed the OAuth issue by installing using npm install googleworkspace/md2googleslides, but I hit another issue right after invoking ~/node_modules/md2gslides/bin/md2gslides.js for the first time:
Screen Shot 2022-07-09 at 21 32 00

(For searching purposes, I see this text in the bottom part of the error: 'redirect_uri: urn:ietf:wg:oauth:2.0:oob')

I followed the instructions in the README.md file.
I've setup a new google cloud project for this, trying to follow the defaults - but maybe I got something wrong there?

Thanks.

@bugok
Copy link
Author

bugok commented Jul 11, 2022

Digging into this a little, I found this stack overflow discussion about this, which seems relevant, explaining that this error is because of a deprecated use of OAuth: https://stackoverflow.com/questions/71318804/google-oauth-2-0-failing-with-error-400-invalid-request-for-some-client-id-but

I think the redirect_url isn't right (it's currently set to urn:ietf:wg:oauth:2.0:oob). Does that make sense? What would be a potential fix?

@bugok
Copy link
Author

bugok commented Jul 13, 2022

Looking at my ~/.md2googleslides/client_id.json file, I see that the redirect_url field is set to ["http://localhost"], but when I run ~/node_modules/md2gslides/bin/md2gslides.js -n and change the redirect_uris parameter to http://localhost - I get passed the error - but nothing happens - because nothing is running on that host:port.

I think I should generate a credentials with a different redirect_uris - but I'm not sure how to do that.

@mlavina
Copy link

mlavina commented Jul 27, 2022

@bugok any updates on your end?

@bugok
Copy link
Author

bugok commented Jul 27, 2022

@mlavina: No, I couldn't get this to work :(
My hunch is that the authentication part of the code could use an update to newer standards - but that's a guess. I'm not sure about this assumption.

@k0kubun
Copy link

k0kubun commented Aug 30, 2022

Digging into this a little, I found this stack overflow discussion about this, which seems relevant, explaining that this error is because of a deprecated use of OAuth: https://stackoverflow.com/questions/71318804/google-oauth-2-0-failing-with-error-400-invalid-request-for-some-client-id-but

The workaround shown in the answer works for md2googleslides too.

Because the problem is coming from urn:ietf:wg:oauth:2.0:oob, you can search the string under node_modules/md2gslides and replace it with http://localhost:1/. In the current main branch, it's here, so I had to modify node_modules/md2gslides/lib/auth.js this time.

Then it will redirect you to http://localhost:1/?code=CODE&scope=..., so you can paste the CODE in the place where md2slides.js asks you to "Enter the code here".

@bugok
Copy link
Author

bugok commented Aug 31, 2022

@k0kubun: That workaround worked! Thanks!

(I still think I should keep the issue open, as the current source doesn't seem to work)

@theluke
Copy link

theluke commented Feb 20, 2023

Same problem here, I applied the workaround, but I am getting a new error "This App tried to access sensitive content..." App is blocked!
Even if you enable the "less secure apps", the error persists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants