Crema React
v-4 nx
v-4 nx
  • About Crema Nx
  • Overview
    • Crema Overview
    • Dependency Graph
    • Folder Structure
      • apps
        • source
        • source-e2e
      • libs
        • components
        • constants
        • context
        • helpers
        • hooks
        • mockapi
        • modules
        • services
    • Package.json
      • MUI+CRA
      • MUI+Next.js
      • MUI+CRA+TS
      • MUI+Next.js+TS
      • Antd+CRA
      • Antd+Next.js
      • Antd+CRA+TS
      • Antd+Next.js+TS
    • GitHub Access
    • Slack Community
    • Figma File
  • Decelopment
    • Installation
    • Route Management
    • Auth User
    • Authentication Methods
    • API Calls
    • Multilingual
  • MUI
    • Theme Color
    • Sidebar Configuration
    • Navigation Style
    • Footer Configuration
    • Template Direction
    • Template Mode
  • FAQ
  • ANTD
    • About Crema Ant
    • Style Framework
  • Crema V-3 Doc
  • Servers
    • Python
    • Laravel
    • Mongoose
  • Credits
Powered by GitBook
On this page
  • Register User
  • Login User
  • Auth User

Was this helpful?

  1. Servers

Mongoose

Crema has some auth inbuilt APIs. Demo APIs listed here -

Last updated 2 years ago

Was this helpful?

You can find out the Mongoose auth APIs public repo

All Auth APIs listed here -

Register User

POST https://www.your-domain.com/api/v1/users

This API is used for the register user

Request Body

Name
Type
Description

name*

String

Name of the user

email*

String

Email of the user

password*

String

Password for the account

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWY0ZjE5ZWNjN2Y5ZGEwMDE3ZDg1YmFkIn0sImlhdCI6MTU5OTAxOTUwMSwiZXhwIjoxNTk5NDUxNTAxfQ.diJyrzPOY-FD7quqhbJ9D5sDdN8Oym40qqfgHoldpdg"
}
{
    "error": "User already exists"
}

Login User

POST https://www.your-domain.com/api/v1/auth

This API is used for the login user

Request Body

Name
Type
Description

email*

String

Email of the user

password*

String

Password of the account

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWY0ZjE5ZWNjN2Y5ZGEwMDE3ZDg1YmFkIn0sImlhdCI6MTU5OTA3MDc3MCwiZXhwIjoxNTk5NTAyNzcwfQ.fK3L6ZmU8S7I-i21kJj_0sA212JOPgFaTWeSeAUaORQ"
}
{
    "error": "Invalid Credentials"
}

Auth User

GET https://www.your-domain.com/api/v1/auth

This API is used to check the auth token validation

Headers

Name
Type
Description

x-auth-token*

String

Bearer token

{
    "_id": "5f4f19ecc7f9da0017d85bad",
    "name": "Demo User",
    "email": "demqo@example.com",
    "avatar": "https://gravatar.com/avatar/8f6b538c5a829890d9d72aba5fc4ed25?d=mm&r=pg&s=200",
    "date": "2020-09-02T04:05:00.903Z",
    "__v": 0
}
here