Skip Menu |

This queue is for tickets about the Net-OAuth2 CPAN distribution.

Report information
The Basics
Id: 95781
Status: resolved
Priority: 0/
Queue: Net-OAuth2

People
Owner: Nobody in particular
Requestors: dmitryb [...] fastmail.fm
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Arbitrary parameters from get_access_token response are not available
Hi, The OAuth 2.0 specification allows the AccessToken Response to contain arbitrary parameters along with the access_token itself (http://tools.ietf.org/html/rfc6749#section-4.1.4). And I know a few OAuth2 providers which pass userid or/and email in response to access_token request. Unfortunately in the library the Net::OAuth2::Profile::WebServer->get_access_token() method returns a Net::OAuth2::AccessToken object which has only predefined attributes and doesn't preserve the originally passed set of parameters. Do you think it would be good to fix it? Regards, Dmitry
I was just perusing tickets and saw your feature request but no response from the author—at least not here. In fact, he added the feature you're looking for just a few days after you posted this (https://metacpan.org/changes/distribution/Net-OAuth2) version 0.58: Wed May 28 23:17:09 CEST 2014 Improvements: - generic accessor of ::AccessToken via attribute() [Sergey Lobanov] With that, all data returned in the access token is available via the attribute() method. For example, using some Salesforce fields: * $token->attribute('id') * $token->attribute('instance_url') * $token->attribute('signature') * et cetera However, to save myself all of the extra typing, I simply subclassed Net::OAuth2 (again, for Salesforce) to make the frequently needed fields first class attributes. I'll probably wrap it up and release it soon because it wasn't trivial...
Subject: Re: [rt.cpan.org #95781] Arbitrary parameters from get_access_token response are not available
Date: Mon, 27 Oct 2014 14:41:30 +0100
To: Jay Allen via RT <bug-Net-OAuth2 [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Jay Allen via RT (bug-Net-OAuth2@rt.cpan.org) [141027 13:35]: Show quoted text
> Queue: Net-OAuth2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=95781 > > > * $token->attribute('id') > * $token->attribute('instance_url') > * $token->attribute('signature') > * et cetera > > However, to save myself all of the extra typing, I simply subclassed > Net::OAuth2 (again, for Salesforce) to make the frequently needed fields > first class attributes. I'll probably wrap it up and release it soon > because it wasn't trivial...
The whole OAuth2 protocol is only used to login and totally network- bound: there is not use for peephole optimizations here. There is no "frequently use" in your code either... It is easy to get namespace collissions, which may cause security problems: I think gluttering these token attributes in between token methods is a bad idea. If you make such an extension, please keep it to yourself and do not distribute it. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
suggestion not taken