I am trying to use OAuth 2 in my Asp.net app (C#). The problem is I need to use a shared google account. To do this, my plan is to seed the authentication with a token, an expiration date, and a refresh token, and then when authentication is required I check the expiration date and use the refresh token.
The example I've been using for Authentication looks like this:
UserCredential credential;
using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read))
{
credential = await GoogleWebAuthorizationBroker.AuthorizeAsync(
GoogleClientSecrets.Load(stream).Secrets,
// This OAuth 2.0 access scope allows an application to upload files to the
// authenticated user's YouTube channel, but doesn't allow other types of access.
new[] { YouTubeService.Scope.YoutubeUpload },
"user",
CancellationToken.None
);
}
And doesn't seem to contain an object with a refresh token.
How do I get the Refresh token and expiration date?