N
N
Nubzilo2015-03-02 18:35:18
OAuth
Nubzilo, 2015-03-02 18:35:18

Is OAuth 2.0 authorization possible without a browser?

Good evening. Please tell me how it is possible, and is it possible, to log in via OAuth 2.0 from a client application (WinForms, you can also use WPF) without using a browser, but using a previously entered login and password?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Nemiro, 2015-03-02
@Nubzilo

The provider may allow the user to accept a username and password and convert them into an access token ( accsss token ). But, as a rule, for security reasons, no one gives such an opportunity.
Try it: if grant_type is password , then user data can be passed in the username and password parameters when obtaining an access token. Or use grant_type equal to client_credentials , then the user data should be passed in the Authorization HTTP header (when using HTTPS , this is a more secure method than password).
For example, if Facebook allowed this, then the access token request could be:

https://graph.facebook.com/oauth/access_token?client_id=123&client_secret=abc&
grant_type=password&username=pupkin&password=000

In my library, there is no way to change grant_type from the outside yet, but you can change it inside. For example, InstagramClient.cs , specify GrantType in the constructor :
And then use the client:
var client = new InstagramClient
(
  "9fcad1f7740b4b66ba9a0357eb9b7dda", 
  "3f04cbf48f194739a10d4911c93dcece"
);
client.ReturnUrl = "http://oauthproxy.nemiro.net/";
client.Username = "aleksey";
client.Password = "Frif#dser#[email protected]";
var accessToken = client.AccessToken;

And the server will respond:
Bad example :P
But Facebook surprisingly returned an access token:
var client = new FacebookClient("1435890426686808", "c6057dfae399beee9e8dc46a4182e8fd");
client.Username = "aleksey";
client.Password = "a6lGmDZsCb1SuHsIQw89ZqK9";
var accessToken = client.AccessToken;

But I have doubts that the supplier will just allow it to be used by just anyone, in real conditions, without restrictions. For certain it is necessary to pass rigid check by the moderator.

N
Nubzilo, 2015-03-02
@Nubzilo

How about a more versatile option? If you need to log in not on Facebook, but for example on Instagram?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question