Windows Azure and Live ID Auth!
OK, so MattT (thanks for the feedback on my blog too Matt :)) pinged me and asked if something had changed in the way Live ID auth worked in Windows Azure.
He was looking around Bing for some samples, and came across this post but couldn’t get it working. You’re right Matt, there was a change.
In late May, 2009, we made a change to the way developers access Live ID, see this post:
So how do you code it up?
Step 1. Download the appropriate SDK (I downloaded the CS one)
Step 2. Go to https://windows.azure.com and create a new Live Services project, make sure you select Live Services: Existing APIs as your project type
Step 3. Enter the details of your Web Role project (you should have created this already, it’s your https://xxxx.cloudapp.net url). The domain should be the straight “xxxx.cloudapp.net” part, in the returnUrl field, enter https://xxxx.cloudapp.net:81/webauth-handler.aspx just while you do local machine testing.
Step 4. Now, while I tested it locally, I had to do a quick update to my hosts file to point my url (crmintegration.cloudapp.net) to 127.0.0.1 so I could test it locally. Just create a pointer to your url in your hosts file to point to 127.0.0.1 just while you test locally. This will enable the above https://xxxx.cloudapp.net:81/webauth-handler.aspx returnUrl to work.
Step 5. Create a Web Role project, and import the WindowsLiveLogin.cs, webauth-handler.aspx and webauth-handler.aspx.cs files from the Windows Live SDK sample directory. You’ll need these to process the return details from Live ID.
Step 6. Run and test, and make sure it’s connecting to Live ID and returning a Id.
Step 7. Deploy to the cloud, remove the local pointer from your hosts file, and update your Live Services returnUrl to not include the port 81 reference. (it should look like https://xxxx.cloudapp.net/webauth-handler.aspx)
To get everyone started, here is a quick sample project that has all the bits in there. You just need to update the web.config with your Application ID and secret from the Live Services page for your project in the Windows Azure portal.
Ping me with questions/issues.
Enjoy :)
Technorati Tags: Windows Azure,Live ID SDK