This feature is only available on the Scale plan. View all plans

You can easily authenticate users on your portal with your existing system by implementing a simple endpoint that generates a JWT and redirects back to Productlane.

1

Activate SSO

Head to the SSO settings and activate SSO by specifying the URL of the endpoint you plan on using. This will generate the JWT secret, please note it down. It won’t be shown again.

2

Implement token endpoint

This is an example of what the token endpoint could look like. You need to add the required auth calls on your end, e.g. to redirect unauthenticated users.

import jwt from "jsonwebtoken"
import { NextApiRequest, NextApiResponse } from "next"

export default function handler(
	req: NextApiRequest,
	res: NextApiResponse,
) {
    // replace with your "getSession"
	const session = { email: "patrick@productlane.com", name: "Patrick" }
	const token = jwt.sign(
		{
			email: session.email,
			name: session.name,
      		// optional
			imageUrl: "",
      		// optional, in minutes
      		tokenValidity: 15
		},
		"pl_sso_...",
	)
    // custom domain example
	res.redirect(
		`https://feedback.example.com/api/portal/sso?token=${token}`,
	)
    // subdomain example
    // res.redirect(
	// 	`https://example.productlane.com/api/portal/sso?token=${token}`,
	// )
}
3

Enable SSO

If your endpoint is ready, enable the SSO switch in the SSO settings. This will start routing traffic to your endpoint, so make sure it’s ready.