Authenticated ID: Second step of exchanging authenticated code for authenticated ID (Public API)

97 views
Skip to first unread message

Livin S

unread,
Mar 11, 2020, 9:00:20 AM3/11/20
to ORCID API Users
I am currently in the second step of getting authenticated ID, but I am being posted with the 401 error when try with following curl commands

1.
curl -i -L -k -H 'Accept: application/json' --data 'client_id=APP-WD9A3TD4COC2JZQG&client_secret=7dae97ec-77fe-4763-a562-5597bcf76d0b&grant_type=authorization_code&redirect_uri=https://pub.orcid.org/v2.0/&code=REPLACE WITH OAUTH CODE' https://orcid.org/oauth/token

2.
curl -i -L -k -H 'Accept: application/json' --data 'client_id=APP-WD9A3TD4COC2JZQG&client_secret=7dae97ec-77fe-4763-a562-5597bcf76d0b&grant_type=authorization_code&code=[Mycode]&redirect_uri=[registered-redirect-url]' https://orcid.org/oauth/token

Kindly let me know, where am I going wrong (I have performed the 1st step in this three step process as stated in the following article, https://members.orcid.org/api/tutorial/get-orcid-id or in the following article, https://support.orcid.org/hc/en-us/articles/360006897174?input_string=exchange+authorization+code+using+public+api)


orcid_issue1.JPG
orcid_issue2.JPG

Pedro Costa

unread,
Mar 12, 2020, 11:28:54 AM3/12/20
to ORCID API Users
Hello Livin,

There is nothing wrong with the curl commands you are using. The problem seems to reside in the tool you’ve used to execute the commands (I think you’ve used https://reqbin.com/curl).

The error received -- "An Authentication object was not found in the SecurityContext" -- usually means that some or all of the data isn't making it to the API endpoint. You can see a previous report in https://groups.google.com/forum/#!msg/orcid-api-users/m5wNeu9iRUQ/oL9TUHNAAAAJ

You could try using another online tool to execute the commands. I’ve tried https://onlinecurl.com/ myself and can confirm it works.

I’d also recommend that you reset your client secret which is compromised for having been posted here. To do this, please go to https://orcid.org/developer-tools, click the pencil icon next to the client name, and then click the button “reset client secret”.

Kind regards,
Pedro
Reply all
Reply to author
Forward
0 new messages