Developers · Users and Permissions
Signing In a User Automatically after Sign Up
Last updated 5 November 2026
This guide shows how to sign a new user in as soon as their account is created, so they do not have to enter their password a second time.
Before you start
You need a sign-up form that posts an email and a password to a page you control. For building the form itself, see Creating a Sign-Up Form.
Step 1: Create the user
Create the user with the user_create mutation and ask for its id back.
app/graphql/users/create.graphql
mutation create_user($email: String!, $password: String!) {
user: user_create(user: { email: $email, password: $password }) {
id
email
}
}Step 2: Sign the user in
In the page that handles the sign-up POST, run the mutation. If it succeeds, pass the new user's id to the sign_in tag.
app/views/pages/sign-up.liquid
---
slug: sign-up
method: post
---
{% liquid
graphql result = 'users/create', email: context.params.email, password: context.params.password
if result.errors
# show the form again with the error
break
endif
sign_in user_id: result.user.id
redirect_to '/'
%}sign_in also accepts timeout_in_minutes, for example {% sign_in user_id: result.user.id, timeout_in_minutes: 120 %}.
Things to know
- After
sign_in,context.current_userholds the new user for the rest of the request and on later requests. - Signing in issues a new session cookie. The cookie from before sign-in no longer works.
- There is a
sign_intag but nosign_outtag. sign_inwith an empty user id raises an error and leaves the current session as it was.
See the sign_in entry in Insites Liquid Tags.