Receiving Token via WebRequest?

2

Personal is there any way I can generate a token through a WebRequest? Because every time I use the Google Drive function, I need to open the authentication page only to generate the access Token, is there any way I can do it through WebRequest?

    
asked by anonymous 05.04.2017 / 16:34

1 answer

1
            var clientrest = new RestClient(baseUrl);
            var requestToken = new RestRequest("oauth/token", Method.POST);
            requestToken.AddParameter("grant_type", "password");
            requestToken.AddParameter("username", model.Login);
            requestToken.AddParameter("password", model.Senha);
            var responseToken = clientrest.Execute<TokenViewModel>(requestToken);
            responseToken.Data.access_token; // acesso ao token

I used restsharp link

    
05.04.2017 / 16:48