helpers import GetAuthCodeServer from onedrivesdk. The service_resource_id of the service you want to access. This uses a slightly differentĪuth flow than the standard code flow - note the use of redeem_refresh_token with Then, you can build a client to access those resources. YourĪpp must first use the Resource Discovery helper to find out which service you can access. To interact with the OneDrive API, your app must authenticate for a specific resource. Once your app is authenticated, you should have access to the OneDrive API, andĬan begin making calls using the SDK. #this will block until we have the code code = GetAuthCodeServer. get_default_client(Ĭlient_id = 'your_client_id', scopes = scopes) helpers import GetAuthCodeServer redirect_uri = ' client_secret = 'your_app_secret' scopes =Ĭlient = onedrivesdk. This method cannot be used on all environments. That helper class spins up a webserver, so That manual work, you can use the helper class GetAuthCodeServer.
The above code requires copy-pasting into your browser and back into your console. authenticate( code, redirect_uri, client_secret) Print( 'Copy everything in the address bar after "code=", and paste it below.')Ĭlient. # Ask for the code print( 'Paste this URL into your browser, approve the app \'s access.') OneDriveClient( api_base_url, auth_provider, http_provider)Īuth_url = client. HttpProvider()Īuth_provider = onedrivesdk.
Import onedrivesdk redirect_uri = ' client_secret = 'your_client_secret' client_id = 'your_client_id' api_base_url = '' scopes =