Skip to content

Contember authentication in Next.js #761

Answered by jonasnobile
ascm00 asked this question in Support
Discussion options

You must be logged in to vote

Hi there!

Integrating Contember authentication into a Next.js app breaks down into two parts: configuring Contember Engine’s Tenant API (for sessions and invitations) and wiring up Next.js to issue, consume, and protect those sessions. Here’s a concise, step‑by‑step outline:


1. Configure Contember sessions
Contember exposes a GraphQL Tenant API for user sessions. To sign in, call the signIn mutation (providing email, password and an optional expiration) and grab the returned session token. To log out, call the signOut mutation.

# Example: sign in
mutation {
  signIn(email: "[email protected]", password: "secret", expiration: 60) {
    ok
    result { token }
    error { code }
  }
}

# E…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ascm00
Comment options

Answer selected by ascm00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants