Skip to content

silverback-ventures/sample-partner-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample app that integrates with Daffy

This is a sample app to interact with Daffy public API. The public API it's in BETA so all methods are subject to change.

Check the BETA documentation here: https://daffy-docs.notion.site/Public-API-6f76f6a682984dd99daca5f7fe892d07


How to run this sample:

  1. Update your .env file Enter your CLIENT_ID, CLIENT_SECRET and ISSUER_HOST.
  2. start the node server by running node index.js.
  3. visit localhost:8080 and sign in.

Public API flow

The way partners make API requests to Daffy is via JWTs via OpenID. In order to obtain a JWT on behalf of a user, the flow goes like this:

  1. User goes to your site and you prompt them to Sign in with Daffy.
  2. User is taken to Auth0 where they authenticate, neither Daffy or the partner access login credentials.
  3. When Auth0 completes the sign in process the user is taken to the redirect URL for the partner, which is configurable inside .env with BASE_URL.
  4. The previous callback will send a JWT that the partner stores via session or at a DB and it's used to talk to the Daffy public API. See routes/index.js axios.post method.
  5. Subsequent API calls to Daffy need to send two parameters inside the Authorization header. Like this:
  Authorization: client_id jwt_token

For an example see the routes/index.js axios.post method.

About

A sample project to connect with the public Daffy API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages