Giter Site home page Giter Site logo

Comments (20)

fkalis avatar fkalis commented on June 27, 2024
The provided value for the input parameter 'redirect_uri' is not valid. The client application must be marked as 'mobile', or the value must be an absolute URL which matches the registered redirect URI.

The error description reads as if your application is still not marked as mobile app.

I just went to https://apps.dev.microsoft.com/#/appList and created a new application. I have then added the 'Mobile' platform for the application and configured the AppID as api_client_id and the Application Secret as api_client_secret in the file onedrive.cfg. I was able to successfully complete the authorization process.

Microsoft seems to have modified their UI. I will update the README file to match the new process/wordings.

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Thanks for the quick response. When I visit https://apps.dev.microsoft.com/#/appList I see the App I created and 'Mobile application' under Platforms.

Yes I had previously made the onedrive.cfg changes as mentioned - btw I previously had to click 'Generate New Password' under Application secrets to create a Password/Public Key.

Hence, in my onedrive.cfg I have the following already but get the error mentioned.
api_client_id set to "Client Id (App Id)" i.e. eaa31...
api_client_secret set to the value I got when I created the app (just a portion shown now in "Password/Public Key" i.e. Buk...)

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

Ah, now I see what I have done differently:

apps

I have created my app as a Live SDK application (second Add button).

When I create a "normal" app (first Add button), I can reproduce your problem. Thank you for the hint. I will try to make the authorization process work for "normal" apps, too.

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Ah, great. To be honest I don't know the difference between normal and Live SDK and can probably change mine to be the latter kind too. Will try to understand all this better and get back if I still have issues. Thanks, Nik

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

I have added a link to the README file, which can be used to create a Live SDK application in case the "Add an app" button is missing.

Please try to register an app using this link and tell me, if this works for you.

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Thanks..off on holiday now but will look at this when back :-)

Atb, Nik
Sent from Samsung Mobile

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Hi,

The 'README' link above takes me to https://apps.dev.microsoft.com/?mkt=de-de#/appList/create/sapi which is in German however I changed the link to https://apps.dev.microsoft.com/#/appList/create/sapi and when clicking 'Create Application' I come to a page that does allow me to create a 'Live SDK application' (though clicking on 'Learn more' takes me to a page which says 'This documentation is archived and is not being maintained.')

Originally I'd gone to https://account.live.com/developers/applications which at that time gave me just a single 'Add an app' button. Now after having created a 'Live SDK application' through following the link above I see an additional 'Add an app' button under 'Live SDK applications' (rather than 'My applications')

I guess Microsoft is changing the way all this works but are keeping the original API working for now.

Anyway, having changed onedrive.cfg happily the script does in fact work (note that the portion that uses bash-json-parser failed until I copied that single file in from its separate GitHub project - it wasn't included in the zip I downloaded)

Thanks for your help!

As mentioned originally I was after a script that I could run on a Linux platform to be able to upload a file to the Microsoft Cloud platform (in fact at work we use OneDrive for Business and SharePoint so those are the platforms I'd ultimately want to be able to upload files to). I previously had a curl script for uploading to SharePoint (on premise) which was quite simple e.g.

curl --ntlm --user Nik:Password1 --upload-file testfile.xlsx https://share.mycompany.com/Site/Shared%20Documents/testfile.xlsx

however it looks like the process for uploading a file is now more involved (I guess to reduce the chance of credentials being stolen as they are transmitted over the internet).

Thanks, Nik

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Btw I tried to create a 'Live SDK application' (by going to https://apps.dev.microsoft.com/#/appList/create/sapi) using my work OneDrive for Business account but this gives me "There's a temporary problem with the service. Please try again. If you continue to get this message, try again later.". I am able to create a 'regular' app using my work OneDrive for Business account. Hence, an enhancement might be to get this to work with OneDrive for Business.
Thanks, Nik

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

rootik has provided support for OneDrive for Business.

Please try again using the modified script.

from bash-onedrive-upload.

nilukk avatar nilukk commented on June 27, 2024

Hi - yes this new script works for me thanks!

I got the error described "AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided." when running onedriveb-authorize but after adding a new key, updating onedriveb.cfg and re-running onedriveb-authorize I was happily able to upload a file.

Atb, Nik

from bash-onedrive-upload.

rootik avatar rootik commented on June 27, 2024

I appreciate your feedback, Nik. Now I think my suggestion not to use 2 years keys was related to this error, so we can try 2 years keys too. I will consider this in the next commit.
I have this script in production environment for now.

from bash-onedrive-upload.

laurenzfg avatar laurenzfg commented on June 27, 2024

Hi, today I tried to set up your script myself. Microsoft might have changed their UI again, I was unable to create a "Live SDK Application". Creating a normal mobile application with the Live SDK option checked did not help as well. Console keeps outpuuting the following after ./onedrive-authorize:

{"error":"invalid_request","error_description":"Public clients can't send a client secret."}

Keep up the good work!

1
2

from bash-onedrive-upload.

cnxzcxy avatar cnxzcxy commented on June 27, 2024

@Laufi
hi, I have successfully made it. here are my steps:

  1. create apps from here https://apps.dev.microsoft.com/#/appList/create/sapi , name your app as you like, now we call it video-upload for example.
  2. go to app detail, your url is like https://apps.dev.microsoft.com/?mkt=zh-cn#/application/sapi/00000000xxxxxxxx
  3. add mobile application platform
  4. follow the instructions as README.md

now, you can upload your files!

from bash-onedrive-upload.

laurenzfg avatar laurenzfg commented on June 27, 2024

@cnxzcxy
Sounds good, will certainly try it!

Cheers!

laufi

from bash-onedrive-upload.

laurenzfg avatar laurenzfg commented on June 27, 2024

@cnxzcxy Works. You rock! Maybe the readme.md could be improved?

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

@rootik Can you please check, if the script in branch feature/28-converged-applications works for OneDrive for Business, too? It uses the Microsoft Graph API, which might help unifying onedrive-* and onedriveb-*.

from bash-onedrive-upload.

rootik avatar rootik commented on June 27, 2024

Hello, @fkalis
I can confirm simple file upload is working with Graph API

./onedrive-upload -d -f Protected README.md
2016-11-23 16:18:59 Acquiring new access token
2016-11-23 16:19:01 Searching for 'Protected' in ''
2016-11-23 16:19:02 api_folder_id is now '01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH'
2016-11-23 16:19:02 Size of README.md is less than or equal to 104857600 bytes, will use simple upload
2016-11-23 16:19:02 Acquiring new access token
2016-11-23 16:19:03 Uploading 'README.md' as 'README.md' into 01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH
Successfully uploaded 'README.md' as 'README.md'

But I have no succsess with chunked upload yet:

./onedrive-upload -d -f Protected largefile.dat
2016-11-23 16:17:20 Acquiring new access token
2016-11-23 16:17:21 Searching for 'Protected' in ''
2016-11-23 16:17:23 api_folder_id is now '01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH'
2016-11-23 16:17:23 Size of largefile.dat is more than 104857600 bytes, will use chunked upload
2016-11-23 16:17:23 Acquiring new access token
2016-11-23 16:17:24 Requesting upload session for 'largefile.dat'
2016-11-23 16:17:24 Uploading 'largefile.dat' as 'largefile.dat' into 01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH
2016-11-23 16:17:28 Acquiring new access token
2016-11-23 16:17:29 Uploading chunk 0 of 'largefile.dat'
2016-11-23 16:17:29 Content-Length: 9830400
2016-11-23 16:17:29 Content-Range: bytes 0-9830399/157286400
2016-11-23 16:17:34 Retrying upload of chunk 0 of 'largefile.dat' (Previous code: 403)
...
...

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

@rootik I have added a debug output for the upload url. Can you retry the chunked upload and post the upload url?

According the the official documentation, it is not allowed to send the authorization bearer when uploading chunks, which is why I have removed that part from the curl request.

The upload url for OneDrive Personal does no longer contain an access_token, but maybe the upload url for OneDrive for Business still does?

from bash-onedrive-upload.

rootik avatar rootik commented on June 27, 2024

@fkalis now it works. Access token exists in url. This is the output:

./onedrive-upload -d -f Protected largefile.dat
2016-11-24 15:47:53 Acquiring new access token
2016-11-24 15:47:54 Searching for 'Protected' in ''
2016-11-24 15:47:56 api_folder_id is now '01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH'
2016-11-24 15:47:56 Size of largefile.dat is more than 104857600 bytes, will use chunked upload
2016-11-24 15:47:56 Acquiring new access token
2016-11-24 15:47:57 Requesting upload session for 'largefile.dat'
2016-11-24 15:47:58 Uploading 'largefile.dat' as 'largefile.dat' into 01KB37ZVTFUTHRLTSMHZF3LMQ47RFPOJHH
2016-11-24 15:48:00 Upload url is now https://contoso.sharepoint.com:443/personal/rootik_contoso_com/_api/v2.0/drive/root:/Protected:/uploadSession?guid='7b24936e-1d78-43bc-b789-c1aa930ed1d6'&path='~tmp26_largefile.dat'&overwrite=True&rename=False&access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJ... 

entire access token and most chunks skipped

2016-11-24 15:49:27 Acquiring new access token
2016-11-24 15:49:29 Uploading chunk 14 of 'largefile.dat'
2016-11-24 15:49:29 Content-Length: 9830400
2016-11-24 15:49:29 Content-Range: bytes 137625600-147455999/157286400
2016-11-24 15:49:34 Upload of chunk 14 of 'largefile.dat' finished (Code: 202)
2016-11-24 15:49:34 Acquiring new access token
2016-11-24 15:49:36 Uploading chunk 15 of 'largefile.dat'
2016-11-24 15:49:36 Content-Length: 9830400
2016-11-24 15:49:36 Content-Range: bytes 147456000-157286399/157286400
2016-11-24 15:49:45 Upload of chunk 15 of 'largefile.dat' finished (Code: 201)
Successfully uploaded 'largefile.dat' as 'largefile.dat'

from bash-onedrive-upload.

fkalis avatar fkalis commented on June 27, 2024

@rootik Do you see any reasons to keep any of the onedriveb-* files after switching to the Graph API? I have merged

  • silent mode
  • exponential timeout

from the onedriveb script back into the onedrive script.

from bash-onedrive-upload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.