Auto-login for Customer Portal
Vaibhav Devpura avatar
Written by Vaibhav Devpura
Updated over a week ago

Why Use Auto-login?

Auto-login simplifies the user experience and provides a seamless transition from your app/dashboard to the customer portal. By allowing users to access the portal without interruption, you can collect valuable user information and tailor your interactions accordingly.

Enabling Auto-login

To enable auto-login for your customer portal, you will need to generate a unique token for each user and add it as a query parameter to the customer portal link on your application. Follow the steps below to set up auto-login:

Step 1: Generate a Unique Token

To generate a unique token for each user, use the following JavaScript function. This function creates an encrypted token containing the user's name, email, and workspace

API key.

function generateToken(CUSTOMER_PORTAL_URL, NAME, EMAIL, WORKSPACE_API_KEY) { const tokenString = `${NAME}/${EMAIL}/${WORKSPACE_API_KEY}`; const token = btoa(tokenString); return `${CUSTOMER_PORTAL_URL}/auto-login?token=${token}`; }
  • CUSTOMER_PORTAL_URL: This is the URL of your customer portal. You can specify it as '<https://portal.zeda.io/helloworld'> or any other valid URL.

  • NAME: Your user's username.

  • EMAIL: Your user's email address.

  • WORKSPACE_API_KEY: To find the workspace API key, go to your Zeda dashboard, navigate to 'Settings,' and then select any of the 'Integrations.' You'll find the API key for your workspace at the bottom of the page.

Here's an example of how to use this function:

CUSTOMER_PORTAL_URL - '<https://portal.zeda.io/zeda>' or '<https://feedback.starkindustries.com>' NAME - 'Tony Stark' EMAIL - '[email protected]'

Step 2: Add the Token to the Customer Portal Link

Once you've generated the unique token using the generateToken Function: you'll need to add it as a query parameter to the customer portal link in your application. This is all you need to do!

After completing this step, your logged-in users will be able to redirect to the customer portal and be automatically logged in.

Note: For auto-login to work, the user in your app must be a member of your workspace on Zeda. Non-users will be directed to the existing login flow.

Did this answer your question?