Skip to content

clauseHQ/demo-api-nodejs

 
 

Repository files navigation

Clause - API Sample

This sample demonstrates how authenticate against the Clause API from a Node.js server.

Warning

This sample does not authenticate requests between the client and the server. You should secure API requests between your client and your server to protect your Clause data.

The sample only demonstrates the server-side code for using the Clause API.

Getting Started

To use this sample, create a file config.js in the /src directory with the contents:

module.exports = {
  domain: 'login.clause.io',
  clientId: {CLIENT_ID},
  callbackUrl: 'http://localhost:3000/callback',
  apiUrl: 'https://api.clause.io'
}

You should replace {CLIENT_ID} with the value of your Client ID. Your Client ID can be found by following the instructions at developers.clause.io

Then enter the following commands at the terminal to run the sample on your machine

npm install
npm run start

You should now be able to run the sample on your local machine: localhost:5000/

Troubleshooting

If you receive the following error:

unauthorized_client: Callback URL mismatch. http://localhost:5000/callback is not in the list of allowed callback URLs

Then you should contact Clause support ([email protected]) to get your callback URL added to your Auth0 application.

License

This project is licensed under the MIT license. See the LICENSE file for more info.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.5%
  • HTML 12.3%
  • Dockerfile 1.5%
  • Shell 1.1%
  • Other 1.6%