Crema React
v-2
v-2
  • About Crema(CRA)
  • Product Overview
  • Folder Structure
  • Installation
    • Pre-Requisites
    • Installing Crema
  • Default Route
  • Customization
    • Template Style
    • Template Mode
    • Template and Sidebar Color
    • Tempate Direction
    • Navigation Style
    • Footer
    • Footer Type
    • Route Transition
  • Multi-Lingual Support
    • Changing Language
    • Adding New Language
  • Sidebar Menu
    • Adding New Menu
  • Route Protection
  • Loggedin User
  • Axios Setup
  • Package.json
  • GitHub Access
  • Slack Community
  • FAQ
  • Next.js
    • About Next.JS
    • Installation
    • Folder Structure
    • Route Protection
    • Deploy to server
  • Servers
    • Python
    • Mongoose
    • Laravel
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://crema-mongoose.herokuapp.com/api/users

This endpoint allows you to get free cakes.

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 http://crema-mongo-api.herokuapp.com/api/auth

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 http://crema-mongo-api.herokuapp.com/api/auth

Headers

Name
Type
Description

x-auth-token

string

{
    "_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