Asynchronous methods, callback URIs, and local development

239 views Asked by At

I'm working with the Pocket (Formerly Read It Later) API, which requires some asynchronous methods - something I'm new to.

I understand the very basic principle that asynchronous methods improve performance by allowing the application to move forward while processing more taxing methods.

With the API, I have to use an async method to authenticate the user. When calling one of the methods, I must provide a call-back uri. This tells Pocket what site they should reroute to after authentication. I see that the uri is correct in the authentication page's url:

https://getpocket.com/auth/authorize?request_token=5dfc83ba-1116-3c4c-
bbbfb2&redirect_uri=http://localhost:44320/index.aspx

For some reason, however, this just prompts Pocket's Authentication page to reload. When trying a "dummy" uri, like http://www.google.com, the page correctly redirects. This tells me there's something it doesn't like about "localhost".

Are there any tips for avoiding this?

1

There are 1 answers

1
Greg Ennis On BEST ANSWER

I'm not sure why Pocket wouldn't allow a localhost callback, but Twitter doesn't either.

I have worked around it by:

  • Using 127.0.0.1 instead of localhost (doesn't work anymore for twitter)
  • Use a bogus name like test-pocket.com and put that in your hosts file to resolve back to localhost (this works)

I'm sure there are other workarounds I haven't thought of...