Receive Token through Webrequest?

Asked

Viewed 312 times

2

Guys 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, there is some way I can do this by Webrequest?

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

used restsharp https://www.nuget.org/packages/RestSharp

  • this "client" would be what?

  • ignore was error at the time of paste I already edited

Browser other questions tagged

You are not signed in. Login or sign up in order to post.