Repository navigation
Closed
Description
What is the problem you are having with rclone?
pasting the JSON string from running:
rclone authorize "onedrive"
doesn't work on Mac (freezes after pasting part of the JSON string, not the complete string) but pasting the exact same JSON string works fine under Ubuntu
What is your rclone version (output from rclone version)
rclone v1.44
- os/arch: darwin/amd64
- go version: go1.11.1
Which OS you are using and how many bits (eg Windows 7, 64 bit)
macOS 10.13.6 (64)
Which cloud storage system are you using? (eg Google Drive)
OneDrive
The command you were trying to run (eg rclone copy /tmp remote:tmp)
rclone config
and then pasting the JSON output of running:
rclone authorize onedrive
A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)
2018/11/09 23:32:56 DEBUG : rclone: Version "v1.44" starting with parameters ["rclone" "-vv" "config"]
2018/11/09 23:32:56 DEBUG : Using config file from "/Users/osama/.config/rclone/rclone.conf"
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive
...
Storage> 18
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
rclone authorize "onedrive"
Then paste the result below:
result> {"access_token":"eyJ0eXAiOiJKV1QiLCJub25jZSI6IkFRQUJBQUFBQUFDNXVuYTBFVUZnVElGOEVsYXh0V2pUSjZPbFBESno0Rkg0VmJsRUZWNjZHTkh6Ym9GUnphVmF6dU5wMnJyeGVmVVc1bzJXOXJaM0N1bkg3a09Zb1RCckFoSFM3cGhOTW96UDEyeVF0NTV6U2lBQSIsImFsZyI6IlJTMjU2IiwieDV0Ijoid1VMbVlmc3FkUXVXdFZfLWh4VnRESkpaTTRRIiwia2lkIjoid1VMbVlmc3FkUXVXdFZfLWh4VnRESkpaTTRRIn0.eyJhdWQiOiJodHRwczovL2dyYXBoLm1pY3Jvc29mdC5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC81NzUzNzc3ZC05MzQwLTQwZTYtYTU5Mi0yZGU3Y2IyNjkyZDEvIiwiaWF0IjoxNTQxNzYyNzU0LCJuYmYiOjE1NDE3NjI3NTQsImV4cCI6MTU0MTc2NjY1NCwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IjQyUmdZTmo1WjFmbllWUEY2TC9kbHo1YmRmbGtmRXE0SVdpYWVIOXAvWXhHUS9lc2FlWUEiLCJhbXIiOlsicHdkIl0sImFwcF9kaXNwbGF5bmFtZSI6InJjbG9uZSIsImFwcGlkIjoiYjE1NjY1ZDktZWRhNi00MDkyLTg1MzktMGVlYzM3NmFmZDU5IiwiYXBwaWRhY3IiOiIxIiwiZmFtaWx5X25hbWUiOiJFbG5hZ2dhciIsImdpdmVuX25hbWUiOiJPc2FtYSIsImlwYWRkciI6IjExOC4xMjcuMTA5LjIwIiwibmFtZSI6Ik9zYW1hIEVsbmFnZ2FyIiwib2lkIjoiOThjNTVmODMtZjA4ZS00OTJkLTg0MzgtOWNjYWZkNTdkYjAxIiwicGxhdGYiOiI1IiwicHVpZCI6IjEwMDMzRkZGOTlGMjM4RUUiLCJzY3A
It hangs and doesn't paste in the entire JSON string. Running the exact same sequence on Ubuntu works without issue.
Activity
Cnly commentedon Nov 9, 2018
@ossie-git Could you also tell us which terminal emulator & shell you are using? I think that'll be helpful.
And what happens if you paste the first half and then the second of the JSON manually? Thanks!
ossie-git commentedon Nov 9, 2018
I tried this using both: Terminal and iTerm. After a little further investigation, it looks like terminals on Mac OS X have a maximum paste buffer of 1024 characters (https://superuser.com/questions/264407/macosx-10-6-7-cuts-off-stdin-at-1024-chars) and this is a limit that you can't easily change.
There are two possible solutions:
I took route 2 and it worked but the solution is far from ideal. I think you might want to look into solution 1 where you just ask the user to copy the JSON string (so it is in the clipboard) and not paste it manually and then have rclone use pbpaste (which comes with Mac OS X) to paste it on the user's behalf
[-]OneDrive Issue on Mac OS X[/-][+]Can't paste long `authorize` result on macOS[/+]ncw commentedon Nov 11, 2018
This is what I think is happening
You are configuring a remote rclone using your macOS machine. You have two terminals open
rclone authorizerclone configThe cut and paste from 1. to 2. is failing because of the 1024 char limit. So far so good.
We could use
pbcopyin 1. to get the text into the clipboard - that would work fine, but I don't think that is the problem.In 2 we can't use
pbpastebecause the it is running on the remote server, not locally. Runningpbpasteon the remote machine will do things with the remote machine's clipboard.So I think the solution of using
pbpastecan't be made to work easily :-(Any other ideas?
ossie-git commentedon Nov 11, 2018
pbpaste would solve the Mac OS X problem (limited buffer).
For the remote connection issue, you can just configure it locally on your Mac and then copy/paste the relevant part from the config file to the remote machine (and remove it if you want from your Mac).
Am I missing something?
ncw commentedon Nov 12, 2018
The problem as I see it is that the rclone which needs to receive the input is running on the remote machine.
pbpastewill only work on the local machineIf you wanted it to work remotely you'd have to do something like
That wouldn't work though. You could set the token something like this though
If you are doing that then you might as well just use the auto config method which doesn't require cut and pasting? This is: https://rclone.org/remote_setup/#configuring-by-copying-the-config-file pretty much.
ossie-git commentedon Nov 17, 2018
For some reason it wouldn't work when I used the auto config method which is why I resorted to
instead. However, when I tried auto config again, it would work but usually after a few tries. So some tries would fail and then one would succeed. Not sure why
ncw commentedon Nov 17, 2018
How did it fail? Do you have a log message?
ivandeex commentedon Nov 16, 2020
@ossie-git
Looks like you are no longer interested in this issue, right?
ivandeex commentedon Nov 16, 2020
@ncw
Do you think we have enough info to add a consistent note in the documentation?
If not and the author's not back for a while, let's close this.
7 remaining items
Cnly commentedon Jun 22, 2021
It turns out that this is not only affecting macOS after we've switched to the new format (with base64 encoding) for
rclone authorizeresults. I needed to paste a token of ~3800 chars which grows into ~5100 chars after base64 encoding, and this is beyond the Linux kernel's default TTY line buffer of 4096 chars.Luckily with the new encoding we can now split the
authorizeresult into multiple lines (<= 1024 chars each) which should survive pretty well across platforms. What do you think? Do you see any potential problems with this? If not, I can open a PR for further testing. @ivandeex @ncw[-]Can't paste long `authorize` result on macOS[/-][+]`authorize` results may be too long for multiple platforms[/+]ivandeex commentedon Jun 22, 2021
4K onedrive token? I think microsoft developers are crazy.
ncw commentedon Jul 5, 2021
@Cnly Splitting the token into multiple lines sounds like a great plan which will make it much easier for the users.
maxboehm commentedon Mar 14, 2025
One addition to that topic: I stumpled upon this problem on v1.69. by unconciously choosing a corporate account onedrive while I actually wanted to use my private onedrive account. It is not just buffering.
calzemelmancvp commentedon Jul 31, 2025
This is still a problem in 2025. I have v.1.70.3 with Ubuntu Linux 64-bit on both sides (one is server, one is my PC with a browser). I run:
rclone config reconnect <my remote>on one side. I get the very long token. I confirm I am copy-pasting from the first character (e) all the way to end (J9). I paste it into the SSH session for my server and...
oauthutil: warn if rclone authorize code can't be decoded #2732
ncw commentedon Aug 1, 2025
@calzemelmancvp can you try this please (on the rclone you are pasting into)
v1.71.0-beta.8969.dc78afb1b.fix-2732-authorize-length on branch fix-2732-authorize-length (uploaded in 15-30 mins)
It will print a couple more error messages if it can't decode the base64 - it shows the error and the code - check if it is truncated.
ncw commentedon Aug 16, 2025
I have merged a fix for this b0b3b04 which will be released in v1.71
oauthutil: warn if rclone authorize code can't be decoded rclone#2732