Skydrive, OAuth and Live account hell.

I’ve started to try and integrate Skydrive access into AzureCopy and have learned a number of important lessons, mainly around OAuth. I’ve often dabbled in OAuth, partially knowing what I’m doing, partially copying examples and partially good luck.

AzureCopy is a command line tool, but performing the “OAuth Dance” seems to always require a browser. This browser step should only ever be required to get the refresh token (well strictly speaking the “code” which can be used to get the refresh token). Until I figure out how to get command line apps to work properly with OAuth I’m going to leave this in a semi-completed state.

For now, I’ll be leaving Skydrive integration in “extreme beta” which means you have to know what you’re doing and get your refresh token manually.  The steps to do so are:

1) Load URL:

https://login.live.com/oauth20_authorize.srf?client_id=00000000480EE365&scope=wl.offline_access&response_type=code&redirect_uri=http://kpfaulkner.com

2) Log in with your live id (microsoft account) and it should return a url similar to:

http://kpfaulkner.com/?code=75a26998-356f-c1c0-3ae1-12345

3) Copy the value of the code parameter and paste into the azurecopy.exe.config entry in the “SkyDriveCode” tag.

4) Use AzureCopy via command line as usual, now you’ll be able to use skydrive for source/destination.

AzureCopy will then retrieve a RefreshToken from SkyDrive and request fresh AccessTokens per session. Currently this is source only and not in any released binaries, but is definitely moving along. Once I’ve finished this I think I’ll target RackSpace or DropBox…

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s