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.

4

1 回答 1

0

我可以通过使用 UI 上的授权按钮来做到这一点。单击将发出 http 请求以通过响应取回令牌。

这是它的角度代码:

$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;
        });
};

因此,当用户授权(或拒绝)您的应用程序的请求令牌时,Pocket 将通过打开您在调用 /v3/oauth/request 时提供的 redirect_uri 将用户返回到您的应用程序。

希望有帮助。

于 2015-10-08T04:59:56.120 回答