0

I am trying to get access token for Pocket. I am using MEAN stack.

I am trying to run the following query in the browser:

https://getpocket.com/auth/authorize?
request_token=YOUR_REQUEST_TOKEN&redirect_uri=YOUR_REDIRECT_URI

But i am not sure how to obtain the access_token back.

I tried running the same in POSTMAN app as well but it returns the authentication page. (PS: I was able to get access token for foursquare using POSTMAN).

How do i get access token in here.

jsbisht
  • 9,079
  • 7
  • 50
  • 55

1 Answers1

0

I was able to do this with using a authorise button on the UI. On click of which a http request would be made to get back the token via response.

Here is the code for it in angular:

$scope.authPocket = function () {
    var request = {
        consumer_key: "your key",
        redirect_uri: "http://localhost:8888/api/pocket/get_token"
    };

    Snippets.authPocket(request)
        .success(function(code) {
            console.dir(code);
            var redirect_uri = "http://localhost:8888/api/pocket/save_token";
            var redirectUrl = 'https://getpocket.com/auth/authorize' +
                "?request_token=" + code +
                "&redirect_uri=" + redirect_uri;
            console.log('Redirecting page to:\n' + redirectUrl);

            $window.location.href = redirectUrl;
        });
};

So, When the user has authorized (or rejected) your application's request token, Pocket will return the user to your application by opening the redirect_uri that you provided in your call to /v3/oauth/request.

Hope that helps.

jsbisht
  • 9,079
  • 7
  • 50
  • 55