Jump to content

Pocket workflow with oAuth login


Recommended Posts

UPDATE 25/05/13 - rewrote the whole damn thing in python, added aleoop for quick updates

 

Hey guys, 

I've finished creating a pocket workflow, I know there are several already in the forums, but this one doesn't require your username/password at any point. (Not that other workflow creators are malicious!)

 

You can download it here (https://github.com/altryne/pocket_alfred/raw/master/Pocket%20workflow.alfredworkflow)

 

and all the code on github (the code is a bit of a mess, I was learning ruby as I was writing)

 

 

Usage : 

First login with "pocket_login", this will redirect you to the pocket site to authorize

xOUb+.png

Afterwards use "pocket" to share a URLs

 

Supports : 

  • Chrome - if running
  • Safari - if running
  • Clipboard - if contains URL

 

hhS9+.png

 

I've banged my head for a long time trying to achieve the sleak oAuth flow, and finally done it, if anyone's interested I can write a blogpost about it.

 

Lemme know what you think, and what improvements/suggestions you may have.

 

credits to https://github.com/vitorgalvao/alfred-workflows/blob/master/Pinadd/pinadd for the chrome and safari applescripts

Edited by altryne
Link to comment

Awesome workflow!

 

Any chance of adding the ability to browse latest entries or search for items by tag?

 

It's a bit beyond me right now, I wasn't sure how to use gems with ruby scripts in alfred, so all the code is pure ruby 1.8 (is what ships with mnt lion)

As the Pocket API returns a json object, serializing it myself is too tough of a job, unless someone can help me with it :)

Link to comment

I am getting the following message when I try to save a URL to Pocket:  "Something went wrong. Try to login again".  The authorization process itself goes through fine and I even get the message that I'm successfully connected to Pocket.  I only get the error message when trying to save a URL.

Link to comment

It's a bit beyond me right now, I wasn't sure how to use gems with ruby scripts in alfred, so all the code is pure ruby 1.8 (is what ships with mnt lion)

As the Pocket API returns a json object, serializing it myself is too tough of a job, unless someone can help me with it :)

 

Have a look at Duane Johnson's install_gem.sh script to easily install gems in the workflow's directory. You could also look in to using Bundler and running `bundle install --standalone --clean` after setting up your Gemfile (this is what Zhao Cai's ruby template uses). Bundler basically lets you declare all your dependencies in one file so you can easily install/update them all at once.

Edited by Clinton Strong
Link to comment

I am getting the following message when I try to save a URL to Pocket:  "Something went wrong. Try to login again".  The authorization process itself goes through fine and I even get the message that I'm successfully connected to Pocket.  I only get the error message when trying to save a URL.

 

Same for me.

Link to comment

Have a look at Duane Johnson's install_gem.sh script to easily install gems in the workflow's directory. You could also look in to using Bundler and running `bundle install --standalone --clean` after setting up your Gemfile (this is what Zhao Cai's ruby template uses). Bundler basically lets you declare all your dependencies in one file so you can easily install/update them all at once.

 

If I use bundler, does that mean that everyone who uses the workflow has to have bundler installed? (i'm really new into ruby)

 

 

 

I am getting the following message when I try to save a URL to Pocket:  "Something went wrong. Try to login again".  The authorization process itself goes through fine and I even get the message that I'm successfully connected to Pocket.  I only get the error message when trying to save a URL.

 

 

Same for me.

 

Can you guys please go into the workflow directory, and remove the "token" file from there, and try to login again?

Link to comment

If I use bundler, does that mean that everyone who uses the workflow has to have bundler installed? (i'm really new into ruby)

 

Oh, sorry about that. When you use `bundle install --standalone`, it creates a folder called 'bundle' in the current directory and installs the gems there. If you add `require 'bundle/bundler/setup.rb'` to your file, it'll set up the paths to the gems even if Bundler isn't installed.

Link to comment

Does this work for anyone at all?

i've tested it a lot with different users on different macs, and it seemed to work, but when I went through the logs guys here who it didn't work for, I saw bugs I couldn't replicate (or understand)

 

So, does this code work for anybody exept me and all my 4 macs and 2 users? 

This will greatly save me some time debugging/rewriting if I know that I'm the only one this works for :)

Link to comment

I got it to work 1 time yesterday after I re-downloaded the workflow.  It was able to save the first URL I clicked on, but after that, any time I tried to save any other URL's, I got the error message.    I've tried re-authorizing several times, re-downloading the workflow, and saving different URL's from various sites and still get the error message.  

 

Thanks for working on this.  I love the workflow and would be using it frequently.

Link to comment

Tried many times but I still get a successful login, picks up the frontmost tab's address or clipboard if there is one, -> message saying something went wrong please login again. Tried deleting the token, whole workflow, diff browsers, - kinda lost. Thank you for the effort though!

Link to comment
  • 2 weeks later...

Love the workflow, but it stopped working for me as well.

Sometimes it would say that it successfully added the the page, and it would indeed show up in my Pocket app, but when opening up the article Pocket would tell me that "This page does not appear to be an article" and will not even show a thumbnail image like it usually does.

Also, when trying to view the page in a web view, the page never loads.

Edited by donosaur
Link to comment
  • 1 month later...

this is a great workflow and would love to use it if it wasn't for the error message.

 

i have no problems with the oAuth login but it's saving the url and messing with it. it saves the link but when you click to go to the original page it renders an error message (you can see the garbled percentage character in the address bar)

 

any plans on updating the workflow good friend developer?  :)

Link to comment

this is a great workflow and would love to use it if it wasn't for the error message.

 

i have no problems with the oAuth login but it's saving the url and messing with it. it saves the link but when you click to go to the original page it renders an error message (you can see the garbled percentage character in the address bar)

 

any plans on updating the workflow good friend developer?  :)

 

Thanx, currently started a new job and don't really have time, I hope to work on it some time soon, will update here

Link to comment

Love the workflow, but it stopped working for me as well.

Sometimes it would say that it successfully added the the page, and it would indeed show up in my Pocket app, but when opening up the article Pocket would tell me that "This page does not appear to be an article" and will not even show a thumbnail image like it usually does.

Also, when trying to view the page in a web view, the page never loads.

 

 

What's the latest on this?  I'd love to use it.  I keep getting "Something went wrong. Try to login again" as well.

 

 

this is a great workflow and would love to use it if it wasn't for the error message.

 

i have no problems with the oAuth login but it's saving the url and messing with it. it saves the link but when you click to go to the original page it renders an error message (you can see the garbled percentage character in the address bar)

 

any plans on updating the workflow good friend developer?  :)

 

Please try now guys, and lemme know if this works for ya

 

https://github.com/altryne/pocket_alfred/raw/master/Pocket%20workflow.alfredworkflow

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...