Create redirect link
POST /api/v1/companies/{companyId}/users/{userId}/redirects/web-app
The Redirects API lets your integration hand an already-authenticated user off to the Repset web app without asking them to log in again. You call the endpoint with the user’s companyId and userId, optionally tell it which page to land on, and get back a one-time URL you redirect the browser to.
The endpoint returns two URLs: sessionRedirectUrl and statelessRedirectUrl. The session URL redirects the user to the authentication server and sets cookies, establishing a logged-in session on Repset. The stateless URL does not establish a session. Since third-party cookies are blocked in iframes, only the stateless URL can be used within an iframe.
The returned URLs are single-use and expires after expiresIn seconds — generate a fresh one for every redirect.
Using the redirect
Request a Redirect URL, then open it in a new tab, an iframe, etc.
const res = await fetch(
`/api/v1/companies/${companyId}/users/${userId}/redirects/programs/new`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
appearance: { theme: "repset" },
}),
},
);
const { sessionRedirectUrl, statelessRedirectUrl } = await res.json();
// Open Repset logged in, in whatever context you like
window.open(sessionRedirectUrl, "_blank", "noopener");
Specifying theme
// Forces Repset to use light mode. This is not persisted on the user and is only
// used to match your application's theme, so it does not affect the user's saved
// theme preference.
{
"appearance": { "theme": "light" }
}