0

I am working with Pocket API to get the access token. I have obtained the request token using a POST request.

Now i have to redirect the current page localhost:3000/api/pocket_auth to redirect UI page to show:

https://getpocket.com/auth/authorize?request_token=6aeb888-1234-dfed-5757-5cc666&redirect_uri=http://localhost:3000/api/get_token

I tried:

res.writeHead(301, {Location: redirectUrl} );
res.end();

And

res.redirect(redirectUrl)

But they make a POST request without redirecting the UI page to authentication page.

How can i get the access token in this case. I am using angularjs for frontend.

jsbisht
  • 9,079
  • 7
  • 50
  • 55
  • You can use [Grant](https://www.npmjs.com/package/grant) on your server, which is OAuth middleware for NodeJS, that supports GetPocket. So basically it will handle the *dirty* work for you. – simo Jul 17 '15 at 13:24

1 Answers1

0

I am taking another approach to get the access token for pocket.

I am getting the 'code' value in angular and then redirecting the UI. Now once user authenticate, I will redirect him to my server say, 'http://localhost:3000/api/get_token'.

jsbisht
  • 9,079
  • 7
  • 50
  • 55