Getting e-mail address

43 views
Skip to first unread message

Eben Roux

unread,
Apr 14, 2021, 4:19:03 AMApr 14
to ORCID API Users
I'm struggling trying to get the e-mail address, or addresses, for a record.

What I've done (C#, RestSharp):

First I call:

```
```

Then I get the token from `https://sandbox.orcid.org/oauth/token`:

```
var tokenRequest = new RestRequest(credentials.GetTokenUrl($"oauth/token"))
{
Method = Method.POST,
RequestFormat = DataFormat.Json,
};

tokenRequest.AddHeader("content-type", "application/x-www-form-urlencoded");
tokenRequest.AddParameter("application/x-www-form-urlencoded", $"client_id={credentials.ClientId}&client_secret={credentials.ClientSecret}&grant_type=authorization_code&code={code}", ParameterType.RequestBody);
```

Then I try to get the email by calling `https://api.sandbox.orcid.org/v3.0/ORCID/email`:

```
var userRequest = new RestRequest(credentials.GetDataUrl($"{tokenResponse.orcid.ToString()}/email"));

userRequest.AddHeader("Accept", "application/vnd.orcid+json");
userRequest.AddHeader("Authorization", $"Bearer {tokenResponse.access_token}");

var userResponse = _client.Execute(userRequest).AsDynamic();
```

However, I receive the following response:
```
{
  "response-code": 401,
  "developer-message": "401 Unauthorized: The client application is not authorized for this ORCID record. Full validation error: The client application is forbidden to perform the action.",
  "user-message": "The client application is not authorized.",
  "error-code": 9017,
}
```

What am I missing?

Monica Duke

unread,
Apr 19, 2021, 9:16:22 AMApr 19
to Eben Roux, ORCID API Users

 

When you requested Sandbox credentials, did you request them for public or member API? Could the problem be similar to this previous ticket?

 

https://groups.google.com/g/orcid-api-users/c/PQVA7r2ao8E

 

If it is a public API Sandbox client, try pub.sandbox.orcid.org/version instead of api.sandbox.orcid.org/version

As in this list of endpoints:

 

https://github.com/ORCID/ORCID-Source/tree/master/orcid-api-web

 

Monica

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orcid-api-users/7749255c-3f1c-4c20-a296-68794c68d6c7n%40googlegroups.com.


Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under company number. 05747339, VAT number GB 197 0632 86. Jisc’s registered office is: 4 Portwall Lane, Bristol, BS1 6NB. T 0203 697 5800.

Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 02881024, VAT number GB 197 0632 86. The registered office is: 4 Portwall Lane, Bristol, BS1 6NB. T 0203 697 5800.

Jisc Commercial Limited is a wholly owned Jisc subsidiary and a company limited by shares which is registered in England under company number 09316933, VAT number GB 197 0632 86. The registered office is: 4 Portwall Lane, Bristol, BS1 6NB. T 0203 697 5800.

For more details on how Jisc handles your data see our privacy notice here: https://www.jisc.ac.uk/website/privacy-notice

Eben

unread,
Apr 20, 2021, 2:01:48 AMApr 20
to Monica Duke, ORCID API Users

Thanks Monica,

 

That has done the trick.

 

Sent from Mail for Windows 10

Reply all
Reply to author
Forward
0 new messages