Hot answers tagged

11 votes

What exactly is a valid OAuth domain name for registering your app?

The OAuth Domain is either: A valid domain that you own and control, and that is hosted somewhere the client can reach. Say, for example that you owned unicorns.mil. See this answer and this answer ...
Brock Adams's user avatar
  • 12.9k
9 votes
Accepted

Can the redirect_uri contain port number?

You got that error because you set the OAuth Domain like example.com:8080, not the redirect_uri. That's not how you configure non-standard ports; see below. The redirect uri, with port, feature now ...
Brock Adams's user avatar
  • 12.9k
8 votes
Accepted

How can I quickly get an access token for personal use?

It's possible to authenticate yourself via the command line; there's no need to set up a website or so. Open the application page via https://stackapps.com/apps/oauth and make sure the option 'Enable ...
Glorfindel's user avatar
  • 6,732
6 votes
Accepted

As a user, where in the web UI could I find all the tokens I have granted for Stack Apps?

Go to your profile: https://stackapps.com/users/current Click the "Edit Profile & Settings" tab: https://stackapps.com/users/edit/current Click "Applications" on the left sidebar (no handy ...
Shog9's user avatar
  • 641
4 votes
Accepted

Refresh expired acess token basics

Dealing with token expiration is pretty simple. When a token is/goes bad then, when you make an API call that uses the token, you will get a JSON response like this: { "error_id": 403, "...
Brock Adams's user avatar
  • 12.9k
4 votes

Creating personal applications using Stack Overflow/Stack Exchange API

If you need something for personal use, it doesn't really matter. You can even use example.com, as long as the site doesn't redirect and change the URL. You'll need a browser and a tool like curl. ...
Glorfindel's user avatar
  • 6,732
3 votes

Find out whether a user has association bonus

Yes, you can find out if the user has received the association bonus using the API. It's a bit clunky though. However, as we discovered, "association bonus rights" are rather meaningless at the ...
Brock Adams's user avatar
  • 12.9k
3 votes
Accepted

Cannot get redirect_uri to work

There have been no reported changes to the API, officially for many years, (unofficially since January). But, frankly that script's approach should have never worked. OAuth credentials are sent to: &...
Brock Adams's user avatar
  • 12.9k
3 votes
Accepted

Implicit OAuth flow puts the access token in the hash?

No, you can't get the access_token in the query/search part of the URL. This would be a security leak that would allow 3rd parties to see your access_tokens on the web. Reference: OAuth2.0 Implicit ...
Brock Adams's user avatar
  • 12.9k
3 votes
Accepted

Is there a way to specify how long I want an access token to be valid for?

Yes, I always get 86399 too. And, no, you can't specify an interval other than no_expiry. But you can call /access-tokens/{accessTokens}/invalidateDoc at whatever interval you wish. So, for less ...
Brock Adams's user avatar
  • 12.9k
3 votes
Accepted

Access token keeps being invalidated

Turns out this is completely my fault :/ I overlooked the expiry aspect of the access token which meant that I got the default 86399 seconds (~24 hours), which meant my users had to get a new access ...
ᔕᖺᘎᕊ's user avatar
  • 4,365
3 votes
Accepted

iOS Client for stackoverflow always throws redirect_uri not a valid uri

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 ...
Brock Adams's user avatar
  • 12.9k
3 votes

Suddenly getting "Couldn't parse `client_id`"

I have now reproduced this in this glitch app for which you can find the code for here. Feel free to remix. The crucial issue is the POST in Step 4 of the explicit OAuth flow. The docs state: POST (...
rene's user avatar
  • 2,462
2 votes
Accepted

Same access token between different fetch_token requests

Yes, each time you invoke stackexchange.com/oauth/ you will get a fresh access token, even though old ones may still be valid. For example: Go to /me/inboxLivedoc and hit Get Token twice, recording ...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

No 'Access-Control-Allow-Origin' for oauth/access_token

The question is not clear enough. You appear to be trying to use jQuery to do explicit OAuth from a web page. If so, this is not allowed. Explicit OAuth is for servers. You are not running that ...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

`redirect_uri` is not under the registered domain for this application

I don't know about that Ruby/Gem, but your app registration is not correct. You need to configure your app for explicit OAuth2, per this other answer, except enter localhost instead of example.com. ...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

OAuth redirect_uri to https://stackexchange.com/oauth/login_success?xxx strips part of the query string

I don't think that's a bug, for implicit OAuth. Anyway, if I understand RFC 6749 correctly, that is not how you are supposed to do such extra checks. Use the state parameter. And this works. For ...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

I have created a lot of access_token with no_expiry scope while experimenting. How do I delete them?

This is what the /apps/{accessTokens}/de-authenticate route does. Passing valid access_tokens to this method causes the application that created them to be de-authorized by the user associated with ...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

How to use /me to display my profile data in StackExchange API?

For read requests, you must send the token (and key) in the URL. For example: https://api.stackexchange.com/2.2/me?site=stackoverflow&key=dp55hR5Wr9UhOJReA6F2gg((&access_token=...
Brock Adams's user avatar
  • 12.9k
2 votes
Accepted

App post got deleted

Why is my app post deleted? My guess is that an automated process did this. You can still view the post, just copy the URL from the 'Manage your applications' page. If it has a banner 'deleted by ...
Glorfindel's user avatar
  • 6,732
1 vote

Permission request form is broken, approve button is hidden, css variables are missing

This was reported on MSO and is now fixed. Adam Lear said: Looks like I was right and we were, in fact, missing the design library reference. The fix is live in production. Thanks for the report!
double-beep's user avatar
1 vote

Cannot authenticate with OAuth2

I don't know if this is an actual answer to the original issue, but it seems to be working fine now. You can test by clicking on the button in the doc page: https://api.stackexchange.com/docs/js-lib#...
gion_13's user avatar
  • 161
1 vote
Accepted

How to register a Stack App with explicit OAuth 2.0 flow to a third party site?

Note that a URI is not a domain, but this seems to be a common mistake when setting up OAuth2. Also reference: `redirect_uri` is not under the registered domain for this application What exactly ...
Brock Adams's user avatar
  • 12.9k
1 vote

How to get access token from the hash?

Refer to the API Authentication docs; there are a great many things wrong with the URL in the question (at least 5). For starters, it's to the wrong path. stackoverflow.com/oauth/authorize gives ...
Brock Adams's user avatar
  • 12.9k
1 vote

Localhost test Stack App authentication: error 'redirect_uri' does not match

I get the reason: Do not use gem 'omniauth-stackexchange', '~> 0.2.1' ,but instead of gem 'omniauth-stackexchange', git: 'https://github.com/nashby/omniauth-stackexchange.git' The reason see this:...
sylor_huang's user avatar
1 vote
Accepted

oauth 2.0 based on stackexchange api and fetch user details

You can do this using the /me endpoint or the /me/associated endpoint. /me Returns the user associated with the passed access_token. Use this if you want to get user info for a specific site (e.g....
Alex's user avatar
  • 126
1 vote

access_token not present in /oauth/access_token response

Unpack response content with $response->getBody()->getContents(). use GuzzleHttp\Client; Route::get('/approve', function () { header('Location: https://stackexchange.com/oauth?client_id=12345&...
ajthinking's user avatar
1 vote
Accepted

Getting an API key for an application without a server

You don't need a server to get an API key, or even to use OAuth2. Set OAuth Domain to: stackexchange.com, and Application Website to: https://stackapps.com/. See this other answer for more ...
Brock Adams's user avatar
  • 12.9k
1 vote
Accepted

The new implicit authentication dialog doesn't handle comma-delimited scopes

This appears to have been silently fixed, sometime in the last year. Now, both: https://stackexchange.com/oauth/dialog?client_id=1515&scope=read_inbox,write_access,private_info&redirect_uri=...
Brock Adams's user avatar
  • 12.9k

Only top scored, non community-wiki answers of a minimum length are eligible