Search code examples
node.jsoauthoauth-2.0passport.jsclientcredential

Does passport.js support 'Client Credentials Flow'?


I am creating a node.js webapp to access GettyImages API using 'Client Credentials Flow'

Does passport.js support it? if yes, how can I implement that?


Solution

  • passport is typically used to authenticate users on your web site. If your (web) app is calling an external API (e.g. gettyimages), and it is authenticating itself to such external system, then you probably don't need it (and won't need any framework either). The client credential flow is a simple POST:

    This is taken from their docs:

    POST https://api.gettyimages.com/oauth2/token HTTP/1.1
    Host: api.gettyimages.com
    Content-Type: application/x-www-form-urlencoded
    
    client_id=abc123&client_secret=yoursecret&grant_type=client_credentials
    

    Full docs here