hacked in oauth2 support via access_token => Net::OAuth2::AccessToken #3

Open
wants to merge 1 commit into
from

Projects

None yet

3 participants

@ediblenergy

Heya, tried to find a good way to contact you besides a pull request, but there doesn't seem to be any kind of messaging system on github.
Anyways, I added OAuth2 access token support with https://metacpan.org/source/MARKOV/Net-OAuth2-0.53/lib/Net/OAuth2/AccessToken.pm#L5

I've been using it for 2 weeks with this script: https://github.com/ediblenergy/pdd/blob/master/script/greader.pl
and nothing unexpected or weird so far!
If you're interested, I could help out with a test or some docs for it or whatever.

@gray
Owner
gray commented Feb 14, 2013

Heya, tried to find a good way to contact you besides a pull request, but there doesn't seem to be any kind of messaging system on github.

As with most CPAN distributions, RT is the standard way to request features. It is also specifically mentioned in the SUPPORT section of the module documentation.

Anyways, I added OAuth2 access token support...

I think it's important to simplify the user interface, by just accepting a client_id/secret pair instead of username/password and have W::G::R take care of creating a token. It would also have to handle the case where the token expires and has to be refreshed.

@ediblenergy

ah whoops, my mistake.
I don't think it's possible to just provide client_id/secret, see
https://developers.google.com/accounts/docs/OAuth2#installed .
There needs to be a web browser involved, and the user needs to login to
google, consent, etc.
A possible scenario would be a kind of dance where you put in client id and
secret, do like,
warn $reader->authorization_url( client_id => $id, client_secret => $secret
)..
user goes to url, gets the code, plugs that into webservice-google, gets
the access token.. but that's getting very complicated.

Passing an optional refresh token makes a lot of sense, and letting
webservice-google get the access token if it's provided.

On Thu, Feb 14, 2013 at 5:23 PM, gray notifications@github.com wrote:

Heya, tried to find a good way to contact you besides a pull request, but
there doesn't seem to be any kind of messaging system on github.

As with most CPAN distributions, RT is the standard way to request
features. It is also specifically mentioned in the SUPPORT section of the
module documentation.

Anyways, I added OAuth2 access token support...

I think it's important to simplify the user interface, by just accepting a
client_id/secret pair instead of username/password and have W::G::R take
care of creating a token. It would also have to handle the case where the
token expires and has to be refreshed.


Reply to this email directly or view it on GitHubhttps://github.com/gray/webservice-google-reader/pull/3#issuecomment-13582242.

@gray
Owner
gray commented Feb 15, 2013

It looks like it's possible to login without a browser:
https://developers.google.com/accounts/docs/OAuth2ServiceAccount

The other alternative is to just rely on the refresh_token. It never expires and can be used to generate new access tokens, and the user can get that from the Google API console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment