xamarin/Xamarin.Auth — pull request #29 by gaearon (2013-06-04 20:59:54+00:00)
Title: Expose RequestAccessTokenAsync down the hierarchy

We use it to refresh access tokens for Google:

class GoogleAuthenticator : OAuth2Authenticator {
private string clientId, clientSecret;

public Task> RefreshAccessTokenAsync (string refreshToken)
{
return base.RequestAccessTokenAsync (new Dictionary {
{ "grant_type", "refresh_token" },
{ "client_id", clientId },
{ "client_secret", clientSecret },
{ "refresh_token", refreshToken }
});
}

public GoogleAuthenticator (string clientId, string clientSecret, string scope, Uri authorizeUrl, Uri redirectUrl, Uri accessTokenUrl, GetUsernameAsyncFunc getUsernameAsync)
: base (clientId, clientSecret, scope, authorizeUrl, redirectUrl, accessTokenUrl, getUsernameAsync)
{
this.clientId = clientId;
this.clientSecret = clientSecret;
}
}

It would also be convenient if `clientId` and `clientSecret` could be made `protected`, but that's not a big deal obviously.

It could make sense to move `RefreshAccessTokenAsync` down the hierarchy, but so far I've only seen Google use it, so I'm not sure.