GithubHelp home page GithubHelp logo

Client Credential grant_type about grant HOT 8 CLOSED

kvslee avatar kvslee commented on April 28, 2024
Client Credential grant_type

from grant.

Comments (8)

simov avatar simov commented on April 28, 2024

Currently Grant supports only 3-legged server side flow. You can use the request module for grant_type: 'client_credentials'. Here is example for Twitter:

var request = require('request')
request.post('https://api.twitter.com/oauth2/token', {
  form: {
    client_id: '...',
    client_secret: '...',
    grant_type: 'client_credentials'
  },
  json: true
}, function (err, res, body) {/*body contains the credentials*/})

Let me know if it works for you.

from grant.

kvslee avatar kvslee commented on April 28, 2024

Thanks for your quick answer. I could successfully receive access_token with Request.

Simeon, I find that you are the author of Purest, which also uses request. So, when I use Purest, I can pass the access_code like this.

customProvider.query()
  .select('endpoint')
  .auth('access-token')
  .request(function (err, res, body) {});

from grant.

simov avatar simov commented on April 28, 2024

Yep, this is how you pass your credentials using the query API in Purest.

Let me know if you have any problems. Also I'll think about adding this type of flow. Closing this issue for now.

from grant.

kvslee avatar kvslee commented on April 28, 2024

Yes, adding 'client credentials' grant type would be awesome. I like your library because it structures API providers with endpoints. API request codes looks much cleaner.

from grant.

simov avatar simov commented on April 28, 2024

@kvslee I think adding support for grant_type:client_credentials will introduce security issue with the current implementation. If you are going to use this type of flow on your web server, you want to have some logic to ensure that the user is authorized to make such request.

Besides that I changed a few things in Purest (currently not on NPM), and actually I introduced a breaking change regarding the refresh method, which is no longer available. Take a look at the examples here on how to request various grant types.

Let me know what do you think.

from grant.

kvslee avatar kvslee commented on April 28, 2024

@simov I did not realize that I could use Purest to do client_credentials.Thanks for the example. And it is also nice to see that you added refresh_token grant type. I like the fact that oauth endpoint can be defined in the provider configuration. Are you going to publish the updates into NPM soon?

from grant.

simov avatar simov commented on April 28, 2024

Yes I'm going to release the new version soon, in about 2 days at most.

from grant.

simov avatar simov commented on April 28, 2024

@kvslee I just released version 1.2.0 of Purest, here is the changelog.

If you have any other issues regarding Purest, address them there.

Thanks for the feedback 👍

from grant.

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.