Gdrive credential problem #34

Open
opened 2026-01-19 18:28:41 +00:00 by michael · 4 comments
Owner

Originally created by @fredlubrano on GitHub.

I'm having an issue with Google Drive. When I run the command, I get the following error message: 'Received close error: invalid argument'. Additionally, the 'transfer' service does not seem to be listening on port 8080, even though it is available.
Thanks

✗  go run main.go --gdrive-client-json-filepath ./credential/creden.json --gdrive-local-config-path ./credential/ --basedir /tmp/ --provider gdrive
Received close error: invalid argument
Go to the following link in your browser then type the authorization code: 
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata&state=state-token

✗ cat ./credential/creden.json | jq .
{
  "installed": {
    "client_id": "480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com",
    "project_id": "massive-cider-378414",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_secret": "xxxxxxxxxxx",
    "redirect_uris": [
      "http://localhost:8080"
    ]
  }
}
Originally created by @fredlubrano on GitHub. I'm having an issue with Google Drive. When I run the command, I get the following error message: 'Received close error: invalid argument'. Additionally, the 'transfer' service does not seem to be listening on port 8080, even though it is available. Thanks ``` ✗ go run main.go --gdrive-client-json-filepath ./credential/creden.json --gdrive-local-config-path ./credential/ --basedir /tmp/ --provider gdrive Received close error: invalid argument Go to the following link in your browser then type the authorization code: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata&state=state-token ✗ cat ./credential/creden.json | jq . { "installed": { "client_id": "480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com", "project_id": "massive-cider-378414", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_secret": "xxxxxxxxxxx", "redirect_uris": [ "http://localhost:8080" ] } } ```
Author
Owner

@paolafrancesca commented on GitHub:

hi @fredlubrano

You don't have a token.json inside ./credential/, correct?

Does go run exit after prompting for ?

Go to the following link in your browser then type the authorization code:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata&state=state-token

you should visit the link, it will print an authorization code that you have to go back to the terminal where you launched go run, paste it and hit enter

@paolafrancesca commented on GitHub: hi @fredlubrano You don't have a `token.json` inside `./credential/`, correct? Does go run exit after prompting for ? ``` Go to the following link in your browser then type the authorization code: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=480001363235-ktbprvug8qkt7m14007f8i1f6cqg42tc.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata&state=state-token ``` you should visit the link, it will print an authorization code that you have to go back to the terminal where you launched `go run`, paste it and hit enter
Author
Owner

@fredlubrano commented on GitHub:

Thank you very much, Andrea, it works with 'copy the token into the terminal'. There was a bit of explanation missing in the documentation. Have a good day, Fred

@fredlubrano commented on GitHub: Thank you very much, Andrea, it works with 'copy the token into the terminal'. There was a bit of explanation missing in the documentation. Have a good day, Fred
Author
Owner

@fredlubrano commented on GitHub:

Hello Andrea,
thank you for your response, but that's precisely what I've been trying to do from the start. I click on the generated URL, which launches the browser. Then, I follow the authorization sequence for Drive, and I end up with a connection error on localhost:8080. I confirm that there is no issue with Rclone.

image

However, Google seems to be sending me a token:

state=state-token&code=4/0Aeaxxxx7tdldq-xxxxxxxxxxxxxxxx-E4d38oxxxx6QqybMKE-xxxxxxxxxxxxxxxxx&scope=https://www.googleapis.com/auth/drive%20https://www.googleapis.com/auth/drive.metadata

fred

@fredlubrano commented on GitHub: Hello Andrea, thank you for your response, but that's precisely what I've been trying to do from the start. I click on the generated URL, which launches the browser. Then, I follow the authorization sequence for Drive, and I end up with a connection error on localhost:8080. I confirm that there is no issue with Rclone. ![image](https://github.com/dutchcoders/transfer.sh/assets/5822329/8823fca6-4b39-47bc-8730-e32dd68da279) However, Google seems to be sending me a token: `state=state-token&code=4/0Aeaxxxx7tdldq-xxxxxxxxxxxxxxxx-E4d38oxxxx6QqybMKE-xxxxxxxxxxxxxxxxx&scope=https://www.googleapis.com/auth/drive%20https://www.googleapis.com/auth/drive.metadata` fred
Author
Owner

@paolafrancesca commented on GitHub:

@fredlubrano it seems something has changed on that on the google side.
It was expected that an authorization is printed on the url you've opened, and you have to copy and paste it in the terminal where you executed transfer.sh.

As a workaround you can try to copy the tokem from from the url you've shared, and paste in the terminal: this could unblock you for the moment.

I will keep the issue open to check the behaviour of a connection to localhost from the link. It is expected to fail, since transfer.sh is not listinening for any connection at that moment, and I general it has no handlers for a callback connection from the link for authorization.

@paolafrancesca commented on GitHub: @fredlubrano it seems something has changed on that on the google side. It was expected that an authorization is printed on the url you've opened, and you have to copy and paste it in the terminal where you executed transfer.sh. As a workaround you can try to copy the tokem from from the url you've shared, and paste in the terminal: this could unblock you for the moment. I will keep the issue open to check the behaviour of a connection to localhost from the link. It is expected to fail, since transfer.sh is not listinening for any connection at that moment, and I general it has no handlers for a callback connection from the link for authorization.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#34