Comments (5)
Yes the default content type is xml.
For json
curl -i -L -H 'Accept: application/json' --data 'client_id=0000-0003-2736-8061&client_secret=5f63d1c5-3f08-4fa5-b066-fd985ffd0df7&grant_type=authorization_code&code=Q70Y3A&redirect_uri=https://developers.google.com/oauthplayground' 'http://api.sandbox-1.orcid.org/oauth/token'
For xml
curl -i -L -H 'Accept: application/xml' --data 'client_id=0000-0003-2736-8061&client_secret=5f63d1c5-3f08-4fa5-b066-fd985ffd0df7&grant_type=authorization_code&code=Q70Y3A&redirect_uri=https://developers.google.com/oauthplayground' 'http://api.sandbox-1.orcid.org/oauth/token'
Please let me know if the above doesn't address your issue.
from orcid-source.
Curious. I suppose it's not too much of an issue as any OAuth2 library either asks for JSON (and so gets JSON), or doesn't ask for anything in particular (and then blindly attempts to parse the response as JSON, ignoring the content-type).
I was just concerned as I requested the token endpoint URL in Firefox, and got an invalid XML warning.
from orcid-source.
Hi Alex,
I'm not following why Firefox would be parsing XML. Please provide the issue you're concerned in reproducible curl statements.
from orcid-source.
My Firefox Accept header is "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8", which prefers XML to JSON. The token endpoint is returning JSON, but with a media type of application/xml. As a result, Firefox attempts to parse the JSON as XML, and gets upset.
Your second curl call returns the following response:
HTTP/1.1 401 Unauthorized
Server: nginx/1.1.19
Date: Thu, 23 Jan 2014 17:00:08 GMT
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Cache-Control: no-store
Pragma: no-cache
WWW-Authenticate: Bearer realm="ORCID T2 API", error="invalid_client", error_description="Client not found: 0000-0003-2736-8061"
{"error":"invalid_client","error_description":"Client not found: 0000-0003-2736-8061"}
(i.e. JSON, served as XML)
Again, it's trivial, and not likely to cause anyone any trouble.
from orcid-source.
Ah, sorry I got it. /oauth/token' only returns json!
curl -i -L -H 'Accept: application/xml' --data 'client_id=0000-0003-2736-8061&client_secret=5f63d1c5-3f08-4fa5-b066-fd985ffd0df7&grant_type=authorization_code&code=Q70Y3A&redirect_uri=https://developers.google.com/oauthplayground' 'http://api.sandbox-1.orcid.org/oauth/token'
Yes that does seem strange, but is part of the spec: http://tools.ietf.org/html/rfc6749 Or at lest how Spring Security implemented the spec.
from orcid-source.
Related Issues (20)
- All work links to Open Library are broken due to wrong casing HOT 5
- https://github.com/ORCID/ORCID-Source/issues/6725#issue-1571462413 HOT 1
- Client ID not found on sandbox.orcid.org (but ok at www.orcid.org) and OAUTH code not working? HOT 1
- Invalid URLs are being passed to RDF Turtle output HOT 4
- A
- Various Accept types appear to return different results HOT 4
- KAMPANAT THUMWONG
- Website URLs are broken by lowercasing HOT 1
- Thank you
- Feature request: New _Creative Work_ Work Type HOT 1
- Treat try-catch block from `ViewMQStatistics`
- ORCID JSON-LD incorrectly asserts that article DOIs are the "sameAs" journal ISSNs! HOT 1
- Add `rel=me` microformat support HOT 2
- [email protected]
- Dogecoin
- Api
- Job.mining
- Replace Transifex with Open source Translation System: Weblate HOT 1
- Job. HOT 1
- Can't generate a read-public access token
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orcid-source.