J'essaie d'utiliser OAuth 2 dans mon application Asp.net (C#). Le problème est que je dois utiliser un compte google partagé. Pour ce faire, mon plan consiste à initialiser l'authentification avec un jeton, une date d'expiration et un jeton d'actualisation, puis, lorsque l'authentification est requise, je vérifie la date d'expiration et utilise le jeton d'actualisation.Comment obtenir un jeton d'actualisation Google Api OAuth 2 pour mon application Web asp.net?
L'exemple que je l'ai utilisé pour l'authentification ressemble à ceci:
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
);
}
Et ne semble pas contenir un objet avec un jeton de rafraîchissement. Comment obtenir le jeton Refresh et la date d'expiration?
devrais-je stocker ce access_token? bcz chacun générera un nouveau access_token. – dilipkumar1007