No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


OAuth2 Client for windows phone. Taking care of:

  • account manager for multiple OAuth2 accounts
  • request access and refresh token
  • grant access through secure external browser and URI schema to re-enter app
  • (implicit or explicit) refresh tokens
  • permanent secure storage
Project Info
License: Apache License, Version 2.0
Build: Visual Studio
Issue tracker:
Mailing lists: aerogear-users (subscribe)
aerogear-dev (subscribe)

Example Usage

In the example below is usage for google, first go to google console create a project select API & auth > APIs and enable Drive API then under API & auth > Credentials select Create new client ID there select Installed application and then iOS (yeah you read that correctly select iOS) this is because iOS also supports setting up a special protocol so that you app continues after being susspended. For bundle id choose any protocol you want.

Go to Visual Studio and open Package.appxmanifest go to Declarations add a protocol and set the bundle id you picked on the google console.

Add protocol

Next step is setting up the account in code, replace the <google-client-id> with your google client id:

var config = await GoogleConfig.Create(													//[1]
    new List<string>(new string[] { "" }),

var module = await AccountManager.AddAccount(config);									//[2]
if (await module.RequestAccessAndContinue())											//[3]

First we create a google config [1] and add it to the AccounManager [2] then we RequestAccessAndContinue if the result is true the app will not be susspended and we can for instance upload to google drive, like in this example. If the result is false the app will be susspended and an Authentication dialog will appear. To handle the continuation event you'll have to have the contiuation manager in you app.

Or implement it yourself:

protected async override void OnActivated(IActivatedEventArgs args)
    if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation)
		//get a reference to the page as IWebAuthenticationContinuable
		var wabPage = rootFrame.Content as IWebAuthenticationContinuable;
		wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs);

The page will have to implement the IWebAuthenticationContinuable interface like this:

async void IWebAuthenticationContinuable.ContinueWebAuthentication(WebAuthenticationBrokerContinuationEventArgs args)
    Upload(await AccountManager.ParseContinuationEvent(args));

This will parse the ContinuationEvent and save the token from the oauth provider ( in this case google ) securly to the device. So next time the user will not need to authenticate again. Upload to google drive passing the OAuthModule with the authentication headers needed

In you upload method you can use the AuthzWebRequest a special WebRequest that will take care of adding the authentication headers.

public async void Upload(OAuth2Module module)
	var request = AuthzWebRequest.Create("", module);
	request.Method = "POST";

	using (var postStream = await Task<Stream>.Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, request))


For more details about the current release, please consult our documentation.


If you would like to help develop AeroGear you can join our developer's mailing list, join #aerogear on Freenode, or shout at us on Twitter @aerogears.

Also takes some time and skim the contributor guide


Join our user mailing list for any questions or help! We really hope you enjoy app development with AeroGear!

Found a bug?

If you found a bug please create a ticket for us on Jira with some steps to reproduce it.