Skip to content

nabla/sample-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nabla Core API Sample App

Sample app screenshot

A minimal web app (in app/) that shows how to interact with the Nabla Core API.


✨ Quick Start

1. Create an OAuth client 🔑

  • Sign in to the Core API admin console: Sign up or Log in.
  • Create an OAuth Client in OAuth Clients section.

2. Generate initial tokens 🌱

You need to use this OAuth client to generate initial user access and refresh tokens for the app. In a realistic architecture, this work would be done by a dedicated authentication backend server on your side. For simplicity's sake, however, we provide an helper node script that imitates a backend server that would create and authenticate a Core API user.

Fill in these variables inside scripts/initialTokensGenerator.js:

  • OAUTH_CLIENT_UUID – UUID of your OAuth client (copy it from the admin console).
  • OAUTH_CLIENT_PRIVATE_KEY – private key matching the public key you registered.
  • REGIONus or eu, matching your organization’s region.

Then execute the script with the command:

# Run with Node ⩾ 18
node scripts/initialTokensGenerator.js

Result: the script writes a userTokens.json file containing your new tokens.

ℹ️ Need a server token instead?
Append --type=server to the command above to generate a long-lived server access token rather than user access/refresh tokens. Use this when calling the Server API directly from your own tools.

3. Configure the frontend ⚙️

Open app/shared/authentication.js and paste the credentials generated in Step 2 (or any other source you use):

const INITIAL_USER_ACCESS_TOKEN  = '...';
const INITIAL_USER_REFRESH_TOKEN = '...';
const REGION                     = 'us'; // or 'eu'

4. Launch the app 🚀

Any static HTTP server works; with Node.js you can simply run:

npx http-server app/
# Then visit http://127.0.0.1:8080/

ℹ️ API version notice:
Please note that this sample app is only compatible with a specific version of the API, specified at the beginning of commonUtils.js file.


📚 Further reading

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7