I have registered for an experimental app and i have the client_id, client_secret and other keys. I have figured out the following -

  1. There is Implicit and Explicit authentication
  2. I am able to construct this uri https://stackoverflow.com/oauth/dialog?client_id=13502&scope=read_inbox,no_expiry&redirect_uri=https://stackexchange.com/oauth/login_success
  3. This leads me to an Authentication Page where I can either Approve it or Reject it.
    enter image description here
    However that is where I get stuck. Since I would like to do all these from inside a python script, how do I automatically Approve my app?

Can I use the client_secret token to automatically make authenticated calls to the stackoverflow api?

  • Once you get that token, store it for use in future runs. There is no way to bypass that page for the initial token -- that would be a huge security hole. If you wish to fully automate the process, your app would have to script that dialog and also know/provide your email and password at the appropriate time. – Brock Adams Nov 4 at 19:30
  • @BrockAdams so you are suggesting, I click on the Approve button and then store the token it sends me ans use it in future ? If yes, then after getting the token, how should my uri for making requests look like....meaning should i just add access_token=xxxxx in the end? – raj Nov 5 at 3:16
  • You must add both the key and the access_token to the URL (or to the form parameters when a POST is required). – Brock Adams Nov 5 at 3:30
  • Unfortunately it gives me an error 400, "key doesn't match a known application", "bad_parameter" – raj Nov 5 at 3:41
  • See stackapps.com/a/6308/7653. Note the (( and )) are part of the respective parameters. – Brock Adams Nov 5 at 3:56
  • @BrockAdams thats precisely what i have been doing https://api.stackexchange.com/2.2/users/13502/inbox?site=stackoverflow&key=%20cytu)NCCeNX8UApP1Fdj8g((&access_token=N0RqHAZAaNAwwFYdf(4Kog)) . As you can see the brackets are intact. Could it possible that my app is actually NOT registered? – raj Nov 5 at 4:58
  • That is not a valid key you just listed. If your app wasn't registered, you should be getting a different error message. If you can't get it to work, ask a proper question with an MCVE. – Brock Adams Nov 5 at 5:05
  • @BrockAdams I am sorry. There is a space in between somewhere. After correcting the query I get a 402 error "access_token does not match user id 13502", "invalid_access_token" – raj Nov 5 at 5:10

You must log in to answer this question.

Browse other questions tagged .