OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
294 stars 143 forks source link

Authenticate multiple users using same (admin) token #140

Closed praveenmb9752000 closed 8 years ago

praveenmb9752000 commented 8 years ago

Hi ,

I am getting just the access token to invoke the APIs from another interface and I need to invoke APIs by just using access token, rather than clientId,returnUrl,scopes as explained in https://github.com/OneDrive/onedrive-sdk-csharp/blob/master/docs/auth.md.

Please tell me how to get OneDriveClient by using Access token.

cdmayer commented 8 years ago

That is not currently supported. To do that, you would need to do 2 things:

  1. Create an AccountSession object with your access token. If you look at ParseAuthenticationResponseValues() you can see how that class handles the response from the auth server.
  2. Either in a sublclass of AuthenticationProvider or in an extension method, create a new authentication method. Use AuthenticateAsync() as a pattern for what needs to happen: you need to get an AccountSession (from step 1) and cache the result using CacheAuthResult().
praveenmb9752000 commented 8 years ago

Then How do I give the Base URL like https://-my.sharepoint.com/personal//_api/v2.0/ I need to change the parameter by accessing the users from any array and give the same Access Token. I am able to invoke different users end point using single Admin Access Token via REST APIs. Can you please suggest me how do this.

To explain what I am trying to do:

  1. I will get Admin Access token and using this I need to invoke different users' api end points using OneDriveClient API and do the necessary back up of items returned.

It would be helpful, if you could share some sample code.

cdmayer commented 8 years ago

This is outside the scope of the SDK. All the tools you need are in the Auth Adapter library. You just need to create your own implementation of IAuthenticationProvider.

praveenmb9752000 commented 8 years ago

Thank you.

On Wed, Oct 12, 2016 at 9:36 PM, Chris Mayer notifications@github.com wrote:

This is outside the scope of the SDK. All the tools you need are in the Auth Adapter library https://github.com/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter. You just need to create your own implementation of IAuthenticationProvider.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OneDrive/onedrive-sdk-csharp/issues/140#issuecomment-253258645, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2h3x7eiLTHMBjImi0NqRbyrf0_2jXWks5qzQWggaJpZM4JYIdS .