ORCID/ORCID-Mock-API-Web-Application — Issue #5: Clarification on requesting tier2 resource
Author: dgcoleman
Created: 2012-02-13 16:00:48+00:00
State: open

Hi.

Working with a simple Perl test script that should do a couple of things:
1. redirect to let the user log in and authorize the client
2. use the returned code to get an access token
3. and use the access token to request a resource.

Relevant pieces of code are:
31 my $client = Net::OAuth2::Client->new(
32 client_id,
33 client_secret,
34 site=>$site,
35 authorize_path=>$auth_path,
36 access_token_path=>$access_token_path,
37 )->web_server(redirect_uri => ("http://spd-qa.nature.com/apps/dtest.pl"));
. . .
44 my $auth_url = $client->authorize_url;
. . .
46 $auth_url .= '/orcid-profile/read-protected';
. . .
56 if($cgi->param('code')) {
. . .
58 my($access_token) = $client->get_access_token($cgi->param('code'));
. . .
68 my $uri = "/t2/" . $access_token->{'orcid'} . "/orcid-profile";
. . .
70 my $h = HTTP::Headers->new(
71 Accept => 'application/x-orcid+xml',
72 );
73 my($response) = $access_token->get($uri, $h);
74 if($response->is_success) {
75 print $response->decoded_content ."
";
76 } else {
77 print $response->status_line . "
";
78 }

Everything works fine up to the get (line 73) using the URI from line 68. At this point the normal response is a 404- Not found. However I have fiddled with things and gotten other responses but none of them what I was hoping for.

The docs are a little contradictory as far as what the URI is supposed to look like. Most specify the tier '/t2/' although there are some that omit that. Likewise, most places say that the service needs to be appended to the URI, although there are some places that omit that.

I am hoping that you might be able to clarify a bit and possibly suggest modifications to lines 68-73 that might get me where I want to go.

Thanks.

D