How to validate the login of a user for the website using Chargebee's login credentials?

Modified on: Tue, 10 Aug, 2021 at 5:22 PM

This is indeed possible. Chargebee allows you to integrate your custom self-service portal by building user authentication on top of Chargebee. If you would want to allow access to parts of your website only to subscribers (like a paywall), you can integrate Chargebee's authentication without having to handle it from your end.

When customers are led to your custom self-service portal from your website, redirect them to the Login URL:

The following parameters should be passed along with the Login URL:

  • return_url - The URL that users should be redirected to upon successful authentication.
  • cancel_url - The URL that users should be redirected to when they want to go back to your website during login.

The domain name used in the Return/Cancel URL should be added as a 'Allow-list Domain' in Chargebee. Add just the domain name in Chargebee and not the entire URL: E.g.

Upon successful authentication, a portal session is created for the user and Chargebee redirects the user to the return_url along with the following parameters:

  • auth_session_id - Identifier to the authenticated session.
  • auth_session_token - Token for the session which should be sent later to activate this session.

With the auth_session_id & auth_session_token parameters, using Activate a Portal Session API, validate the session details and create a session for that user in your website.

Monica is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.