How can I get facebook auth code using restfb

I am creating a java application with RestFB. In this url, Facebook explains how to authenticate using a connection to facebook.

Basically, the following steps:

  • Redirect to facebook as an example.

https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=email,read_stream

2.If I invoke an HTTP request using the above URL, I get the following html .

3. But if I call the link above through my browser, I get the following url that contains the OAuth code.

What I really want is OAuth code, which I can only get through browser 3 , I can not get this code in 2 . I would like to program OAuth code in my standalone java program. How do I achieve this?

+4
source share
1 answer

OAuth program code cannot be software. These codes allow you to perform actions on behalf of the user from whom you receive permission.

When redirecting the browser to the URL in step 1, the browser displays a dialog box in which the user clicks Allow or Skip . Only if the user permits and permits your application, are you provided with the OAuth code.

The answer you get at 2 is probably the HTML screen of the screen that you see at 3.

Further; restFB has nothing to do with authentication. This becomes useful after you receive your passkey.

Last but not least, you can take a look at the Desktop Applications documentation.

+1
source

Source: https://habr.com/ru/post/1401336/


All Articles