It is very easy to override the default login feature (accessible by /login/[provider] endpoints) of the Windows Azure Mobile Services and customize it according to the need of your app. In this blog post, I am going to discuss how to do that, in particular, we want to be able to do the following:
- Add custom claims to the identity (the ability to provide authorization after authentication). In this example, we will add custom claims to the facebook identity.
- Add a new oAuth identity provider (in addition to the ones supported by the Windows Azure Mobile Services). In this example, we will add Foursquare as the new identity provider.
- Add a simple classical identity provider (login by username and password).
- Add support for multiple apps using the same backend. It is necessary, if you have a public API exposed and other people are making apps using your backend.
In this post, I am going to use the oAuth flow described in my previous blog post, which is:
- the app verifies the identity of the user elsewhere, i.e., native facebook app, and acquire an access_token,
- this access_token is used to login to Windows Azure Mobile Services.
But, the examples are easily extendable to any standard oAuth flow.