derrix060 / onedriveClient

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

Can't authorize oneDrive for Business #16

Closed dimk1 closed 5 years ago

dimk1 commented 6 years ago

I run the commands to register to ODfB. After I enter the second link I get the message

Failed to authorize onedrived: interaction_required.

derrix060 commented 6 years ago

Can you provide the full logs? Looks like you are not pasting the url when asked to od.

dimk1 commented 6 years ago

I'm a bit newbie to that. Can you point out how to collect the full logs?

derrix060 commented 6 years ago

interaction_required is a described error from Microsoft that you can check it here.

@dimk1 Please provide the commands that you used and the output.

For example:

$ onedrived-pref account add -b
NOTE: To better manage your OneDrive accounts, onedrived 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 onedrived:

https://login.microsoftonline.com/common/oauth2/authorize?client_id=6fdb55b4-c905-4612-bd23-306c3918217c&response_type=code&redirect_uri=https%3A%2F%2Fod.cnbeining.com&scope=U+s+e+r+.+R+e+a+d+++o+f+f+l+i+n+e+_+a+c+c+e+s+s

The authentication web page will finish with a blank page whose URL starts with "https://od.cnbeining.com". Paste this URL after the prompt.
Paste URL here:
...
derrix060 commented 5 years ago

I just created a new account and sync using a fresh clone of this repo and everything is working fine. If the problem persists, please comment here...

dimk1 commented 5 years ago

Still not able to make this work. I run

me@laptop:~$ onedrived-pref account add -b
WARNING:root:Failed to load config file: [Errno 2] No such file or directory: '/home/jim/.config/onedrived/onedrived_config_v2.json'. Use default.
NOTE: To better manage your OneDrive accounts, onedrived 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 onedrived:

https://login.microsoftonline.com/common/oauth2/authorize?client_id=6fdb55b4-c905-4612-bd23-306c3918217c&response_type=code&redirect_uri=https%3A%2F%2Fod.cnbeining.com&scope=U+s+e+r+.+R+e+a+d+++o+f+f+l+i+n+e+_+a+c+c+e+s+s

The authentication web page will finish with a blank page whose URL starts with "https://od.cnbeining.com". Paste this URL after the prompt.
Paste URL here: https://od.cnbeining.com/?code=AQABAAIAAADXzZ3ifr-GRbDT45zNSEFEssQWKgtESoEvveKzyCeEW98M6GiJP41tRfU2Zq6BEeWMZmmlzNysdeFzdJ_rM5O4igb12_u9wnJD_gavRwCWHk_QQL3ftKgLTbGpZ0JLEq9bIsC53NwhJtmjvAKllXTcEJ6oFILDUndAssizizNJE15oUUEMWFQkNACoiNkKyMrHci1NHA2uYPDk2XF8QLVAGCXHD8SehlJGA9gzeY3SkzrqkEf6LvAKlTRLu84Oohs5eXE2zg9XRm0w4rOCAmAsDJtHKSuoeQAnW2IzcEQRBi62hoj3PUh5XvAy2o6CWHzv_3wcTtcX8CuSinEuVTiYB8VRYAJjJvxHsg5sCrx8oF8yPRTbQl69vWuGXWu21kj35_VGImyss7UYQcgFX1-rZInzLbool4exY8ajql_eax2ziCy5RI46GLkCkL24eF6--0tLAyOJCdERWHNO-1MHgLaOyl3NbCLtZ58CIHaKCf6jThY5QB2LK-CEeePSnJDJl1stuVGjrW-Pz7nBtFpC5LtDq8H_fv73qm-Rd6-noJhx7rJfsPWkwGCPVVBI7A9-cpFOfvDpOSQhjbmpx5xFcvGk7VyEPeFam9q1XW7DcI_RCWUuMGSmWy9bOFTFIeHFPv3YH4AIBqPqDQeeR0b5nhSmZOztPdLd793KZkRKp0UWsQeARQr-pk9aggc3OMpY587vGCxBRxY0v8Yfkr1RB1Ug3i_NDtGBzKpCJ533jRnlTCOv_388KJWKGqWtQLAgAA&session_state=ba04320e-644f-4bdc-bb24-0604019d6b29
Need authenticate again to get personal information'
Paste this URL into your browser to sign in and authorize onedrived:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=0e170d2c-0ac5-4a4f-9099-c6bb0fb52d0c&response_type=code&redirect_uri=https://onedrivesite.mario-apra.tk/&scope=User.Read offline_access

The authentication web page will finish with a blank page whose URL starts with "https://onedrivesite.mario-apra.tk/". Paste this URL after the prompt.
Paste URL here: https://onedrivesite.mario-apra.tk/?code=OAQABAAIAAADXzZ3ifr-GRbDT45zNSEFE6Vpd1OxMFxX2h9wNntyLStATWM3GRdGu5nkIc513u097hPFxtSfAxHhNyvmCHUS-f8nC6Xqd1LAjNBEXZDHMBaf_OK_08mCVgVH6WKSxBBiy1MHyt3umkxyPWShmVkdc9vTeI89WfJnTW9HpSx5IUvSdG_HpinuIXAa70SuJNF1coDqH02GiAcQK_6bK4r2l9vZ3atulfjiboWNxt4MeKuSiaHbtc9zOXq3wfZQzNwy208QFFnPVClll2ciJcKbmQU8N7dXHylFbtOAU9YTxUfK9H2Dk-iw98bS5EMhtBmEV0JazVIvY_Zp6p2nEFqnsdzyzyyVdaAv0UDMjTTu2htKWMqah-arreYzjNBjRHB7suMOtHFYw0ta186evajcgGXIU3P4rGpXgYWQEl91jyEhA9Hl7Fkk6MdknfJfOQtG2kQ9za1hcjSNSIb8Nojfts3-QtkCOxKGCwDkyLHeAIi0agt-7lPjihLYCRs2Ja_2g07OaGgLg6fqRlJRNDNU61m6cmUFj2uSfYwElgiIffOs_cwoEo9GjI_U3Qr81XoP744QLP1llDBxDN7EPjwdiVzYOh1YlIY6ewOlxCTtH_7HgQn0J-CxnefaagyM7hkBH0SbHcrjq13k22HJhMdXOjN11OgBfj1mc5XaM-S1mW0Z3UBvfhGwvRvnb84XGj_fUYVv1qg5oduhK61stggQ7UzTdCWAs3mNAP8GST3b3eugzRqLROlIyI9aMoy_vHm8XQYBklggLapH__i_9T3a-tsiyapAT1XiestSC5BM3lSAA&session_state=90c390d1-bc4a-46ff-9d35-7e4d3174529d

Failed to authorize onedrived: interaction_required.

Microsoft mentions that

Indicates the type of user interaction that is required. The only valid values at this time are 'login', 'none', and 'consent'. prompt=login will force the user to enter their credentials on that request, negating single-sign on. prompt=none is the opposite - it will ensure that the user is not presented with any interactive prompt whatsoever. If the request cannot be completed silently via single-sign on, the v2.0 endpoint will return an interaction_required error. prompt=consent will trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app.

so I could try with the option prompt=login but the links provided during setting up an account are not configurable. Is there any way to add this during account add -b?

derrix060 commented 5 years ago

I will take a look. Can you send me the link where you find this thing from Microsoft and also the commit hash for the project?

dimk1 commented 5 years ago

Thanks for taking a look at this. The link is here. How do I retrieve the hash for the project? I simply used git in my Ubuntu machine to download the app.

modelmat commented 5 years ago

Latest commit has can be found by navigating to the cloned directory and running git rev-parse HEAD

dimk1 commented 5 years ago

Then my commit is c231b13ad4b64e35a1205135fd6ee0b01fb95edc

modelmat commented 5 years ago

Try running git pull as you are running an out of date version of the library.

derrix060 commented 5 years ago

@dimk1 I didn't find this commit on the history, are you sure that you ran the command on the correct directory? And are you using the project from this fork?

Weej1 commented 5 years ago

hi I dont know if I should make a different issue or not but I'm facing the same issue with a different error: When I run sudo onedrive-client-pref account add -b

I get:

WARNING:root:Failed to load config file: [Errno 2] No such file or directory: '/root/.config/onedrive_client/onedrive_client_config_v2.json'. Use default.
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.microsoftonline.com/common/oauth2/authorize?client_id=6fdb55b4-c905-4612-bd23-306c3918217c&response_type=code&redirect_uri=https%3A%2F%2Fod.cnbeining.com&scope=U+s+e+r+.+R+e+a+d+++o+f+f+l+i+n+e+_+a+c+c+e+s+s

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

When I go to the link in the browser I get and undefined message:

selection_005

There is a message in the URL too so here is the entire thing:

https://od.cnbeining.com/?error=access_denied&error_description=AADSTS50005%3a+Device+platform+Unknown+used+by+the+user+is+an+unsupported+device+platform.+Supported+device+platforms+are%3a+iOS%2c+Android%2c+Mac%2c+and+Windows+flavors.%0d%0aTrace+ID%3a+aa85c941-1636-4fcc-90dd-448dc7f87c01%0d%0aCorrelation+ID%3a+74d5f99b-2e3b-4ee0-a93b-beb880a5a8b5%0d%0aTimestamp%3a+2018-11-29+19%3a10%3a27Z

My OS is Deepin 15.08 which is a derivative of the latest Debian-testing.

derrix060 commented 5 years ago

@Weej1 please create a different issue. It's saying that the access is denied, I need to double check if this endpoint is still valid and check in the Microsoft documentation about this error...