Save Token to User Machine

1

I did an integration with GoogleDrive and when doing all the authorization in the consent screen, it creates a token in the appdata of the user, however I put this application in Azure in VM .

But when I create this token it is creating in appdata of VM , but I would like it to create on the user's machine that is accessing the application, follow the code:

UserCredential Credencial = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets 
{ 
   ClientId = ClienteID, 
   ClientSecret = ClienteSenha 
}, 
scopes, NomeUsuario, CancellationToken.None, new FileDataStore("token.aut")).Result;

If someone can help me solve it, I appreciate it.

    
asked by anonymous 29.03.2017 / 19:30

1 answer

1
//Armazenando o token com localstorage
localStorage.setItem('nomedotoken', token);

//Obtendo token com localstorage
var token = localStorage.getItem("nomedotoken");

//Armazenando o token com sessionStorage
sessionStorage.setItem('chave', 'valor');

//Obtendo token com sessionStorage
var data = sessionStorage.getItem('chave');

sessionStorage allows access to a session storage object. The sessionStorage is similar to localStorage, the only difference is that while the data stored in the localStorage does not expire, the data in the sessionstorage has its data cleansed when it expires the page session

Using ASP.NET MVC Storing in Encrypted Cookie

var client = new RestClient("http://localhost:15797");

var request = new RestRequest("api/security/token", Method.POST);
request.AddParameter("grant_type", "password");
request.AddParameter("username", Username);
request.AddParameter("password", Password);

 IRestResponse<TokenViewModel> response = client.Execute<TokenViewModel>(request);
 var token = response.Data.access_token;

 if (!String.IsNullOrEmpty(token))
     FormsAuthentication.SetAuthCookie(token, false);
    
29.03.2017 / 19:58