I made a site that contains a function where it uploads files to the google drive, however I need to authenticate it every time I start a site session, so if I close the page and go back and I need to open the Authentication screen again to create another token for the new session. I Have this code:
public class Autorizacao : FlowMetadata
{
private static readonly IAuthorizationCodeFlow flow =
new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "...................",
ClientSecret = ".................."
},
Scopes = new[] { DriveService.Scope.Drive, DriveService.Scope.DriveFile },
DataStore = new FileDataStore("C:\\Temp\\Autorização.Tokens")
});
public override string GetUserId(Controller controller)
{
var user = controller.Session["user"];
if (user == null)
{
user = Guid.NewGuid();
controller.Session["user"] = user;
}
return user.ToString();
}
public override IAuthorizationCodeFlow Flow
{
get { return flow; }
}
I wanted to do something that does not need to be done doing these authentications every session started, does anyone have any suggestions?
And sorry for my bad english.