OneDrive / onedrive-sdk-dotnet-msa-auth-adapter

Other
25 stars 22 forks source link

Refresh Token in onedrive SDK and graph SDK #46

Open krackinDev opened 7 years ago

krackinDev commented 7 years ago

So we have an application that allows you to create a xml file that runs the app again at a later stage (which may or may not have a user in attendance). Files are stored on the user cloud drive platform of choice. So the process is Workflow 1

  1. Authenticate to cloud with User 1 details/input
  2. Select files to Download and use
  3. Save and encrypt file metadata and Refresh token to xml file. (app workflow 1)

Workflow 2 ( can be repeated multiple thousands of times) Send xml file to another pc with User 2. (either by email or remotely through a console that pc then runs under user 2

  1. start app
  2. App authenticates automatically using refresh token saved in xml file with no user input (as there is a very high chance of the user who created workflow 1 not being in the same city as where workflow 2 is running
  3. Downloads files
  4. applies files (app workflow 2)

PROBLEM all other platforms we cater for (Dropbox and google) gives us access to the refresh token and allow us to authenticate with it again , however both the onedrive and onedrive for business (graph sdks) give us a credential cache blob that require us to be the same user to decrypt ..

Questions

  1. So I need to know how I can get the refresh token from the blob so we can reuse it at a later stage. (yes I'm aware that it will expire after 6 months which is acceptable) . I am trying to avoid having to save a blob byte[] in my xml file as it means the process has to change depending on the platform used instead of the single set of code to handle
  2. When i have the refresh token how do i instantiate the credential cache from it if I am not the same user
  3. What is the format of the blob for deserializaiton or creation of it.

Further note - I have managed to handle all platforms before Within silverlight (where the sdks are not supported) through directly calling the rest api calls but we are converting our solution to WPF and would want to use the sdks

thanks Barry

krackinDev commented 7 years ago

Really nothing? i have managed to make a workaround for onedrive .. but problem still remains in graph sdk? i really need to be able to refresh my token at a later stage

jculverwell commented 6 years ago

Wow, still no comment on this??? @krackinDev are you able to share your workaround?