derrix060 / onedriveClient

A Microsoft OneDrive and OneDrive for Business client for Linux, written in Python3.
MIT License
65 stars 10 forks source link

"We're unable to complete your request" message during "onedrive-client account add" #45

Closed GiltosMx closed 5 years ago

GiltosMx commented 5 years ago

Hey there!

So the issue happens sometimes, but I'm not completely sure on how to reproduce it yet.

While using the command onedrive-client-pref account add, the output for the auth url is the following:

NOTE: To better manage your OneDrive accounts, onedrive_client needs permission to access your account info (e.g., email address to distinguish different accounts) and read/write your OneDrive files.

Paste this URL into your browser to sign in and authorize onedrive_client:
https://login.live.com/oauth20_authorize.srf?client_id=000000004010C916&response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.signin+wl.emails+wl.offline_access+onedrive.readwrite

The authentication web page will finish with a blank page whose URL starts with "https://login.live.com/oauth20_desktop.srf". Paste this URL after the prompt.
Paste URL here: 

So, when pasting the link on the browser you'll get an error: image

And the response is embeded in the wepage url:

https://login.live.com/err.srf?lc=1033#error=invalid_request&error_description=The+provided+value+for+the+input+parameter+'redirect_uri'+is+not+valid.+The+expected+value+is+'https://login.live.com/oauth20_desktop.srf'+or+a+URL+which+matches+the+redirect+URI+registered+for+this+client+application.

I managed to fix it by changing the redirect_uri link to the one suggested in the error: https://login.live.com/oauth20_desktop.srf'

Then it works and I'm able to authorize the app.

Not sure why this happens, but thought I'd share in case anyone else is running into this issue.

derrix060 commented 5 years ago

Hello @GiltosMx, welcome to the project.

The url posted by you looks correct. I've tested the same URL provided by you and works fine:

https://login.live.com/oauth20_authorize.srf?client_id=000000004010C916&response_type=code&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.signin+wl.emails+wl.offline_access+onedrive.readwrite

Can you please try again to see if the problem persists, and if so, try this other link:

https://login.live.com/oauth20_authorize.srf?client_id=000000004010C916&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf&scope=wl.signin+wl.emails+wl.offline_access+onedrive.readwrite

GiltosMx commented 5 years ago

Hey there @derrix060!

Thanks a lot for your quick response. I'm really looking forward to this project being active. I tried using xybu's original one a couple of years ago and was not fully convinced.

On with the issue, it turned out to be a really stupid thing. I was using tmux, and because the pane was split vertically, the link pasted incorrectly (altough it looked fine at a first glance before going to the webpage).

Both links seem to work, and using the second one (https://login.live.com/oauth20_desktop.srf) was how I got it working the first time around.

I think I'm closing this, if that's okay.

Everything seems to be working fine, but I'm a bit curious as the onedrive-client status command always seems to be outputting that the process is sleeping - even upon a fresh install with no files synced locally at all.

Thanks again, and cheers!