Xamarin.Auth - How to get refresh token using Xamarin.Auth?

I use the below Xamarin api to authenticate to a Google account successfully:

https://github.com/xamarin/google-apis

The problem is the access_token it expires after one hour.

` this.auth = new GoogleAuthenticator(ClientID, new Uri(RedirectUrl), DriveService.Scopes.Drive.GetStringValue());

    // We don't want to have to login every time, so we'll use the Xamarin.Auth AccountStore
    AccountStore store = AccountStore.Create();
    Account savedAccount = store.FindAccountsForService("google").FirstOrDefault();

    if (savedAccount != null)
    {
        this.auth.Account = savedAccount;
        Setup();
    }
    else
    {
        this.auth.Completed += (sender, e) =>
        {

            if (e.IsAuthenticated)
            {
                // Save the account for the future
                store.Save(e.Account, "google");

                BeginInvokeOnMainThread(Setup);
            }
            else
            {
                BeginInvokeOnMainThread(ShowLogin);
            }
        };

        ShowLogin();
    }`

How can I get the refresh_token using Xamarin.Auth?

Sign In or Register to comment.