Glenn Ferry is right, there are different APIs that you need to use depending on your specific use case.
Here is the OneDrive Web Picker SDK (JavaScript): https://dev.onedrive.com/sdk/javascript-picker-saver.htm
As for the authentication part of your application, it depends on which APIs you are using. For the sake of this topic, suppose you use Office365 and OneDrive through the OneDrive Web Picker SDK (top):
You will need to make sure your application is registered here so that you can get the necessary API keys (client_id and client_secret): https://account.live.com/developers/applications
This application code must be located on a server that provides the redirect URL that you register with your application (this endpoint should be able to process the data that Micro $ oft will send to your redirect endpoint accordingly) on this page: https: //account.live.com/developers/applications/apisettings .
In the sample code for loading the SDK object, you replace APP_ID with your client_id (from the Live.com developer console):
<script type="text/javascript" src="https://js.live.net/v5.0/OneDrive.js" id="onedrive-js" client-id="APP_ID"></script>
Now you can follow along with the rest of the sample code so that you move in the right direction:
- Define selection options, including successful and canceled handlers.
- Determine how you want to open the selection interface button.
- Handling a successful response and file data
The linked page above contains sample code for all of this and should be sufficient for you to move in the right direction.
I used to help someone who wanted to open the builder from mobile web browsers. Although I did not conduct rigorous testing, I made sure that the documentation page for the OneDrive Web Picker SDK (JavaScript) uploaded the file collector in my desktop browser ... I was not able to get the same collector that will load on mobile versions of browsers. (He may or may not work there ... but it is worth knowing in advance).
source share