11 votes
Accepted

Unable to get access token

Refer to the Stack Exchange API, Authentication docs. It looks like you are trying to authenticate using either a server you do not control, or a local server that is not on the public internet. ...
  • 12.8k
6 votes
Accepted

Does a closed and/or deleted Stack Apps post still provide access to the API?

I've just done a couple of tests with my placeholder app. Even though the question is closed, I was able to generate a new access token (following the regular procedure) for my sockpuppet account, and ...
  • 6,292
6 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 ...
  • 6,292
5 votes
Accepted

Getting "application not configured for implicit grants" error trying to setup website

Yes, it can be annoying that the API docs, the javascript SDK, and the settings pages use the terms: "Explicit" "Implicit" "Server side" "Client side" a little interchangeably. (The first 2 are ...
  • 12.8k
5 votes
Accepted

OAuth procedure for standalone user?

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. ...
  • 12.8k
4 votes
Accepted

Can not request info after OAuth

Your second call must be https:. You actually got an error like: "error_id":406, "error_message":"Access token sent over non-HTTPS request, it has been invalidated", "error_name":"...
  • 12.8k
4 votes
Accepted

After user login, how do you ask user for permissions?

I forgot to add the scope in the authentication url according to this document https://api.stackexchange.com/docs/authentication#scope 1.Send a user to https://stackexchange.com/oauth, with these ...
  • 229
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, "...
  • 12.8k
3 votes
Accepted

Accessing the Stack Exchange API not on behalf of an user?

You only need to use OAuth if you are trying to add or modify data (including votes). If you want to do that, your app must log in as a user, no exceptions. If you just want to read or search data, ...
  • 12.8k
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: &...
  • 12.8k
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 ...
  • 4,335
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 ...
  • 12.8k
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 ...
  • 12.8k
3 votes

'The target origin provided does not match the recipient window's origin' message when trying to use localhost

I faced the same issue when I was using the stack exchange API to post a message to stack overflow website. I figured I had to post my application on a domain name. I hosted my application on free ...
2 votes

I Cannot Perform Oauth

The authentication process is described in the API docs: http://api.stackexchange.com/docs/authentication.
  • 358
2 votes
Accepted

Login using Google fails saying OpenID 2.0 accounts for Google has gone away

So, this was a fun one. :) We apparently broke several different things over the course of a year that went unnoticed until Google turned off OpenID support. In no particular order but for fun and ...
  • 358
2 votes

Application Key and AccessToken are not working for Stack Exchange API?

In my particular case, I somehow managed to append % character to the end of the access_token. There should be no % character at the end of the access_token.
  • 163
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 ...
  • 12.8k
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 ...
  • 12.8k
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 ...
  • 12.8k
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=...
  • 12.8k
2 votes

How do I add a comment to a post through the Stack Exchange API?

For posting comments, you need a request key for your application: Applications should be registered on Stack Apps to get a request key. Request keys grant more requests per day, and are necessary ...
  • 6,292
2 votes
Accepted

Get access token for matrix bridge

Yes, you do. The only way to get access token is via authentication, and you need a registered application for that. What you don't need is a public post here to announce your application; that is ...
  • 6,292
1 vote
Accepted

"Could not parse uri [redirect_uri]" when trying to authenticate

It's not explicitly mentioned in the documentation (perhaps because it uses the term URI, and says it must be 'under' a domain), but for the redirect URI I always use a 'full' address, including the ...
  • 6,292
1 vote
Accepted

How can I the question detail page and add comments like the Stack Exchange app?

Can we get the list of data when clicking on the specific question and display the question detail page like the Stack Exchange app? Sure: use the /questions/{ids} method and apply the appropriate ...
  • 6,292
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:...
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=...
  • 12.8k
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....
  • 126
1 vote

What token parameters to use for OAuth2 Authorizaton?

What software are you using? Anyway, for a Desktop app, you almost always use the "Implicit" (Client side) procedure. Configure your Stack app as shown in this answer. That dialog appears to be set ...
  • 12.8k
1 vote
Accepted

Is it okay to just send the API key (without implementing oauth-2 login)?

Yes, it is perfectly okay. You only need an access_token (OAuth/login) if you are trying to change data, or are accessing private information for a logged-in user. See the Authentication docs for ...
  • 12.8k

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