Skip to content

Implementing contember backend in custom Next.js project #751

Answered by jonasnobile
NotSugat asked this question in Support
Discussion options

You must be logged in to vote

Hi there,

You can indeed leverage the Contember authentication system on your custom Next.js frontend. The key is to use Contember’s Sign in mutation to authenticate users with the same credentials as your Contember admin backend. Here’s how you might approach it:

1. Using the Sign in Mutation

Contember provides a GraphQL mutation for signing in. When you execute the sign-in mutation, it returns a token that represents the authenticated session. For example, if you’re using Apollo Client, your mutation might look like this:

import { gql, useMutation } from '@apollo/client';

const SIGN_IN_MUTATION = gql`
  mutation SignIn($username: String!, $password: String!) {
    signIn(input: { usern…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@NotSugat
Comment options

@jonasnobile
Comment options

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