Authentication OneDrive Python API

10,593

The client_secret and client_id are two required parameters needed to use OAuth2, which is an industry-standard protocol for authorization.

Take a look at these following links to know how to get these information related to OneDrive access:

https://dev.onedrive.com/auth/msa_oauth.htm

Get Access Token with OneDrive API

You will need to register your application following this link: https://dev.onedrive.com/app-registration.htm

After that, your application will receive some request and, with valid user credentials, get access to OneDrive account.

I hope it helps.

Share:
10,593
Mariano
Author by

Mariano

Updated on June 09, 2022

Comments

  • Mariano
    Mariano almost 2 years

    I am trying to use my OneDrive for business with Python.

    I have installed onedrivesdk and now I am in the process of authenticating my OneDrive

    the code provided is the following

    import onedrivesdk
    
    redirect_uri = 'http://localhost:8080/'
    client_secret = 'your_client_secret'
    client_id='your_client_id'
    api_base_url='https://api.onedrive.com/v1.0/'
    scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
    
    http_provider = onedrivesdk.HttpProvider()
    auth_provider = onedrivesdk.AuthProvider(
    http_provider=http_provider,
    client_id=client_id,
    scopes=scopes)
    
    client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
    auth_url = client.auth_provider.get_auth_url(redirect_uri)
    

    I am not sure what is the client_secret and client_id I should provide to get access to my OneDrive

    I will appreciate help regarding from where to get the above mentioned parameters.