Xano Auth

Easy user authentication management

This element is the key that manages persisting your user sessions across page loads and new tabs. This element should be present on each individual page and exposes a bunch of actions, states, and events that are useful for managing your user. We’ve tried to mimic familiar Bubble terminology to make is simple understanding these states.

Xano Auth is used to set and retrieved user auth tokens and data. Each page of your Bubble app must include a Xano Auth element for this plugin to work properly

Setting up your endpoints

The Xano Auth element uses the default auth endpoints created by Xano when you set up your workspace. This element is quite rigid in the data it sends and the response it expects from these endpoints. There are some changes you need to make so be sure your auth endpoints are configured as shown below.

Sign the user up

POST /auth/signup

Request Body

{
    authToken: "<authToken here>"
}

Log the user in

POST /auth/login

Request Body

{
    authToken: "<authToken here>"
}

Get current user

GET /auth/me

Get the user record belonging to the authentication token

{
	id: 4,
	created_at: 1668449225878,
	name: "Bob Johnson",
	email: "bob@johnson.com",
	name_first: "Bob",
	name_last: "Johnson"
}

Available Actions

Sign the Xano user up Accepts first name, last name, email, and password inputs and will sign the user up via the default ‘/auth/signup’ endpoint in Xano.

Log the Xano user in Accepts email and password inputs and will log the user in via the default ‘/auth/login’ endpoint provided by Xano.

If you are using SSO to verify your users in Xano you should use the ‘Set the Xano auth token’ action to log your users token instead.

Available States

First name User’s first name

Last name User’s last name

Email User’s account email

Is logged in Indicates if the user is currently logged in

Auth token Token to store on the user if you want to make authenticated API calls to the Xano API via the API connector

Error message Information about the error that occurred

Error code Code that can be used as conditions to run different workflows when an error occurs

Status code Code returned from the most recent call to the Xano API

Available Events

We have also provided useful events to make managing your users super simple.

User is logged in This event will run anytime a user is manually logged in and on page load if the user’s current auth token is valid. Use this event to save user details to Bubble’s ‘current user’ object from the Xano Auth element.

User is logged out This event will run anytime a user is manually logged out and on page load if the user’s current auth token is invalid or missing. Use this event to clear user details from Bubble’s ‘current user’ object.

Threw an error The event will run anytime an error occurs in the Xano Auth element. Use this event in conjunction with the error states on the Xano Auth element to manage the user experience.

Last updated