Skip to content

How to Handle a Single Page Application

Normally, the customer token is provided during the widget initialization. If you are running a single page application where a user can log in and log out without reloading the page, you need to update the Customer token by using the update method as shown below.

Logout Without Page Reload

To log out a user without reloading the page, use the following code:

javascript
gmf('update', {customerToken: null});

Login without Page Reload

javascript
gmf('update', {customerToken: CUSTOMER_TOKEN});

⚠️ Warning:
API key will give you full access to the API, so be sure to keep it secure! Do not share your API Key in publicly accessiable places such as your git repo, client-side code etc.