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

Error 400: redirect_uri_mismatch when creating credentials #109

Open
hamon-e opened this issue Feb 25, 2024 · 4 comments
Open

Error 400: redirect_uri_mismatch when creating credentials #109

hamon-e opened this issue Feb 25, 2024 · 4 comments

Comments

@hamon-e
Copy link

hamon-e commented Feb 25, 2024

I had to add the URL http://127.0.0.1:8085 to the oauth configuration Authorized redirect URIs otherwise I had the error
Error 400: redirect_uri_mismatch

I think it should be added to that documentation
https://github.com/glotlabs/gdrive/blob/main/docs/create_google_api_credentials.md

Thanks

Btw why not using a service account instead? it would be much easier

@mtrojanowski
Copy link

I think you did not change the application type to Desktop. The desktop application does not require configuring a redirect URI. It should accept any localhost redirect URI.

As for the service accounts — you have to log in as a Google user and authorize the app to access your Google Drive. Would this behavior be possible with service accounts? I haven't checked this, but I think that won't be possible.

@AstrobioMike
Copy link

heya, @hamon-e, I think I'm having the same issue ending at a 127.0.01 refused to connect when trying to set up the account (i did set the application type to Desktop App). Can you tell me where I can access the Authorized redirect URIs to be able to add http://127.0.0.1:8085?

@madaarya
Copy link

same issue here,, the redirect URIs only possible to setup when use web application type

@vitaliikaplia
Copy link

If you’re trying to configure gdrive on a remote server but are stuck with the 127.0.0.1 redirect during the OAuth process, here’s what you can do:

  1. Set up the account on a local machine (gdrive account add):
    Since the OAuth process requires browser access to authorize, complete the account setup on a computer where you have a browser available.
  2. Export the account from the local machine (gdrive account export myaccount):
    Once the account is set up locally, export the account credentials to a file. This file will contain all the necessary information for gdrive to access your Google Drive.
  3. Transfer the exported file to your remote server:
    Use any file transfer method (like SCP) to copy the exported credentials file to your remote server.
  4. Import the account on the remote server (gdrive account import /path/to/destination/myaccount):
    On the remote server, import the credentials file into gdrive. This will make the account accessible on the server without requiring another OAuth setup.
  5. Verify everything is working (gdrive files list):
    Test gdrive on the remote server to ensure it can access your Google Drive files and upload or download as needed.

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