Git Product home page Git Product logo

Comments (5)

rcpeters avatar rcpeters commented on September 16, 2024

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.

alexdutton avatar alexdutton commented on September 16, 2024

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.

rcpeters avatar rcpeters commented on September 16, 2024

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.

alexdutton avatar alexdutton commented on September 16, 2024

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.

rcpeters avatar rcpeters commented on September 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.