Reputation: 17974
I'm trying to produce a web page showing my list of "Read it later" articles stored in Pocket, using their API, and following the directions published on their Documentation.
Step 1: have a consumer key. I created the Pocket App, and have the consumer_key.
Step 2: get an access token. This is where i get stuck. I'm supposed to send a POST request with the consumer_key
and the redirect_uri
, which i fail to understand.
My script sits at domain.com/pocket/index.php, which is where i would like that the token be sent, so i'd assume the redirect_uri
is that url. But in the documentation, they use something like "pocketapp12388:authorizationFinished
" which does not look like a url to me.
In any case, whichever i use I get a "400 Bad Request", which means the redirect_uri is incorrect. What am i doing wrong?
Here is a small demo on jsfiddle.net
Upvotes: 7
Views: 5061
Reputation: 772
Well, nothing is wrong with your query. It doesn't work on JSFiddle because JSFiddle sends the XMLHttpRequest from a different domain to another domain, which is not allowed.
Here is the error message you're getting if you check your console:
XMLHttpRequest cannot load https://getpocket.com/v3/oauth/request. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://fiddle.jshell.net' is therefore not allowed access.
More info on this is here: https://stackoverflow.com/a/20035319/800387
To test your query, you can use Chrome extensions like POSTMan REST Client: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en
Upvotes: 2
Reputation: 21
if you need access token use https://github.com/jshawl/pocket-oauth-php open config.php put you consumer_key and redirect_uri (path.to/callback.p h p) and start path.to/connect.p h p sorry for my english))
Upvotes: 2