Usage and Billing Portal
Get Session Token
2min
you must create a session token to interact with amberflo through api ui kit amberflosdk to do so, you can retrieve it from an endpoint on your server using the browser’s fetch function on the client side this is generally the best approach when your client side is a single page application, especially if it’s built with a modern frontend framework such as react for more information check create a session docid 8wrigrkizlweihh9zldvd this example shows how to create the server endpoint that serves the client secret const express = require('express'); const app = express(); const request = require('request'); app get('/amberflo session', async (req, res) => { request({ method 'post', uri 'https //app amberflo io/session', body { "customerid" "{{desired customer id}}, "expirationepochmilliseconds" {{expiration date in milliseconds}} }, headers { "x api key" "{{your api key}}" } }, function (error, response, body) { if (!error && response statuscode == 200) { res json({ sessiontoken response sessiontoken }) } } ); }) 📘 the above example is in node js you can get x api key from amberflo site inside settings > account > api keys you can also get the customerid from amberflo site inside customers → click on a customer → copy customer id this example demonstrate how to fetch the session token with javascript in the client side const response = fetch('/amberflo session') then(function(response) { return response json(); }) then(function(responsejson) { const sessiontoken = responsejson sessiontoken })