Authentication

Accept organization invitation

Accept an organization invitation using the token from the invite email link (e.g. `/invite/{token}?orgId=...`). Creates a new user with the invited email and adds them to the organization with the invited role. Returns a JWT and user so the client can log the user in immediately. No authentication required.

AuthPublic
GroupAuthentication
Rate limitSee Rate Limits
POST/api/auth/accept-invite

SDK setup

Create a client instance. No authentication is required for this endpoint.

import { Configuration, AuthenticationApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
});

const authentication = new AuthenticationApi(configuration);
import { Configuration, AuthenticationApi } from 'mudbase-sdk';

const configuration = new Configuration({
  basePath: 'https://cloud.mudbase.dev',
});

const authentication = new AuthenticationApi(configuration);

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const { data: result } = await authentication.acceptInvite(
  {
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample",
    password: "Str0ng_Sample_Pass!w0rd",
    firstName: "Angel",
    lastName: "Buckridge"
  }
);
const { data: result } = await authentication.acceptInvite(
  {
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample",
    password: "Str0ng_Sample_Pass!w0rd",
    firstName: "Angel",
    lastName: "Buckridge"
  }
);

Playground

live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

No Request Yet

Send a request to see the full inspector

Authentication

Public — No Auth Required

Request Body

json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample",
  "password": "Str0ng_Sample_Pass!w0rd",
  "firstName": "Marjorie",
  "lastName": "Wyman"
}
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c3JfZGVtbyJ9.sig_sample",
  "password": "Str0ng_Sample_Pass!w0rd",
  "firstName": "Marjorie",
  "lastName": "Wyman"
}

Responses

201Invitation accepted; user created and added to organization
json
{
  "message": "Invitation accepted. You are now a member of the organization.",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "jane.doe@example.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "org": "685ad30be129932fbb7a1047",
    "role": "developer",
    "emailVerified": true
  }
}
{
  "message": "Invitation accepted. You are now a member of the organization.",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "685acbe0e129932fbb7a0fc2",
    "email": "jane.doe@example.com",
    "firstName": "Jane",
    "lastName": "Doe",
    "org": "685ad30be129932fbb7a1047",
    "role": "developer",
    "emailVerified": true
  }
}
400Invalid or expired token, or user already exists with this email

invalidToken

json
{
  "error": "Invalid or expired invitation token"
}
{
  "error": "Invalid or expired invitation token"
}

expired

json
{
  "error": "Invitation has expired"
}
{
  "error": "Invitation has expired"
}

userExists

json
{
  "error": "User already exists with this email"
}
{
  "error": "User already exists with this email"
}
404Organization not found
json
{
  "error": "program back up"
}
{
  "error": "program back up"
}
500

Errors

CodeMeaning
400Invalid or expired token, or user already exists with this email
404Organization not found
500
Edit this page on GitHub