I tried to use the Stack Exchange API to authenticate the user.

I have registered my app with redirect_uri as stackexchange.com/oauth/login_success.

But it always throws "redirect_uri is not a valid uri".


1 Answer 1


That error means either that you've misconfigured the app or that the authentication call is incorrect.

Note that stackexchange.com/oauth/login_success is not a valid redirect_uri irregardless.

You probably want/need to use Client side (Implicit) authentication, in which case the redirect_uri would be:


Note the mandatory https://.

Be sure your app is configured as shown in this answer.

Then you can use a URL like the following to authenticate:

https://stackexchange.com/oauth/dialog?client_id={YOUR CLIENT ID}&scope=no_expiry&redirect_uri=https://stackexchange.com/oauth/login_success

When you fetch that page, something like this will end up as the redirected-to URL:


You would then use the access_token to make an API query like:


(Note that the example token, above, has long since been invalidated. Use your own values for it and for key.)

  • I am unable to give https:// in oauth domain field , it throws error saying port is not allowed in oauth domain Commented Aug 14, 2016 at 19:30
  • Use the setting as shown in this answer EXACTLY (Except for name and description). Commented Aug 14, 2016 at 19:31
  • I should give stackexchange.com in app registeration and should give "stackexchange.com/oauth/login_success" while making the call. Commented Aug 14, 2016 at 19:52
  • 1
    Correct at last. :) Commented Aug 14, 2016 at 19:54
  • I have done all this steps and now i want to authenticate using Stack Exchange API using login form. Can some one tell the steps how to do it?@BrockAdams Commented Aug 10, 2017 at 5:08

You must log in to answer this question.

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