7

Background: I will be using the Stack Exchange API to make queries to stack overflow for a list of questions along with their details for a particular month etc for analysis purposes. So this would be done in Java used by me alone.

How should I handle the OAuth for this ? Would it be an explicit OAuth or implicit ?

3
  • Is this server side? Commented Oct 18, 2015 at 4:16
  • @YummyUnicornRainbowTails Yes. I would say that.
    – Viraj
    Commented Oct 18, 2015 at 16:50
  • Anyone ? I am eager to start my project.
    – Viraj
    Commented Oct 19, 2015 at 19:48

1 Answer 1

6

Refer to the API Authentication doc page, where it says:

explicit grant (is) for server side applications

Also, see What is the difference between the 2 workflows? and related questions.

Basically, unless you have your own web server (and usually your own domain), use the implicit flow. The implicit flow merely requires either a web browser or a program that can act like one -- which your Java program can be made to do.

The explicit flow can nominally be made more secure, but it is not as easy to implement and requires both a client program and a web application to be developed (and hosted) by you.

  1. Use the "implicit OAuth 2.0 flow" (Client side). Activate Enable Client Side OAuth Flow in your app's control panel.
  2. Leave Disable Desktop Application OAuth Redirect Uri unchecked.
  3. Set OAuth Domain to stackexchange.com.
  4. Use redirect_uri=https://stackexchange.com/oauth/login_success.
  5. Be sure to use GET requests for implicit (client side) OAuth and POST for explicit (server-side) OAuth.


When the authentication is successful, the access_token will be in the location.hash of the redirected page. For example:

https://stackexchange.com/oauth/login_success#access_token=5bcPtLjiyuySD7WeKSo3Mw))&expires=86399
1
  • I'd like to use this API simply to return and post answers to StackOverflow. Using a Firestore backend. Can I just use stackexchange.com for the OAuth?
    – Edison
    Commented Jun 7, 2021 at 6:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .