NextJS
Learn more about embedding Oneloop UI in your NextJS App
This guide is for adding our embeddable UI to your NextJS App. If you are looking to add authentication to your NextJS Routes, please refer to the Oneloop NextJS SDK.
Install for a new project
The easiest way to get started is to use the NextJS starter kit.
Install for an existing project
To install the Oneloop SDK in an existing NextJS project, run the following command:
Setup your environment
To initialize the SDK, you need to pass in your Production Access API key as a header. Add it to your .env.local
file
Make sure to keep your API key secure and never expose it in your frontend code. To learn more about environment variables in NextJS, check out the
NextJS documentation
Get the link_token
To initialize the SDK, you need to make a request to the Oneloop API to get the link_token
.
If you are using NextJS, you can make this request in your server-side code.
The following example shows how to make this request in a NextJS API route.
Initialize the SDK
To initialize the SDK, you need to pass the link_token
you received from the Oneloop API using the above created function.
Make sure to pass in the workspaceId
and customerId
you used to get the link_token
.
The Oneloop API Key Manager component needs to be imported in a client-side file.