JS Backend SDK
Before continuing
Make sure you have:
CakeAuth JavaScript backend SDK is a wrapper which exposes the CakeAuth Backend APIs. You can use it to build on top of your application.
If you're not into using an SDK, you can also use the CakeAuth Backend APIs directly.
Installation
Usage
To start using the SDK, you can initiate a new instance of the CakeAuth
class:
Adjust the approach of reading the private key from your .env
file
accordingly. In this example, we're using process.env.CAKEAUTH_PRIVATE_KEY
to read the private key.
To better organize the APIs, all the "endpoints" are mounted under the CakeAuth
's client object. For example, to create a new user, you can use the cakeauth.users.createUser
method:
You can find the full list of available methods in the Backend SDK reference.
What's next?
TODO:
- Add more auth options
- protect pages/components
- protect API routes
- session management
- more on sdk reference
Last updated on