By following this Stack Exchange API documentation, I have registered my application on Stack Apps (here). After registering I got my request key and access_tokens created via authentication.
I need to run the Stack Exchange API via curl command, for that, I ran the following command
curl "https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=stackoverflow&access_token=my-access-token)EuzzA((&key=5RseNTJmS0C35DTMsc2dYQ((" | gunzip
After hitting the above request, I get the following error :
{"error_id":403,"error_message":"`key` is not valid for passed `access_token`, token not found.","error_name":"access_denied"}
For authentication, I referred this and hit the URL https://stackoverflow.com/oauth/dialog with query string parameters, but here also no response is shown.
Can anyone please tell me why this error is coming, even though the parameters mentioned in the curl request are correct OR is there any step left for authentication?
curl "https://api.stackexchange.com/2.2/answers/43919322?order=desc&sort=activity&site=stackoverflow" | gunzip. From your error message, I think that the key is correct and the access token is not correct. So can you confirm your access token again? From your question, it seems that you use the implicit OAuth 2.0 flow. In this case, this thread might be useful. stackapps.com/a/6679/44311 If this was not the direct solution, I apologize.scopeandredirect_uriofhttps://stackoverflow.com/oauth/dialog?client_id=###&scope=###&redirect_uri=###for retrieving the access token using the implicit OAuth 2.0 flow? By this, I would like to confirm whether I can replicate your situation.https://stackoverflow.com/oauth/dialog?client_id=###&scope=no_expiry&redirect_uri=stackexchange.com, I think that please modifyredirect_urifromstackexchange.comtohttp://localhost. And, access it. By this, when you see the URL of the browser, you can seehttp://localhost/#access_token=###. In this case,###is the access token. How about this?localhostasOAuth Domain? Or, if you want to usestackexchange.com, please try the URL ofhttps://stackoverflow.com/oauth/dialog?client_id=###&scope=no_expiry&redirect_uri=http://stackexchange.com.http://localhost/#access_token={accessToken}, please use{accessToken}as the access token. In my environment, I could confirm that the retrieved access token can be used for your curl command. If that was not the direct solution, I apologize.