CourseLayer Logo

Authentication

User authentication and session management endpoints

Authentication

Manage user authentication, login sessions, and access tokens.

Login

Authenticate a user and generate a JWT access token.

Endpoint

POST /api/login

Request Body

Prop

Type

Example Request

{
  "email": "[email protected]",
  "password": "your-secure-password"
}

Response

{
  "status": "SUCCESS",
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "token_type": "Bearer"
}
{
  "status": "ERROR",
  "message": "Incorrect username or password"
}

Logout

Logout the user from all devices. Requires authentication.

Endpoint

POST /api/logout

Headers

Authorization: Bearer YOUR_ACCESS_TOKEN

Response

{
  "status": "SUCCESS",
  "message": "Successfully logged out from all devices"
}

Register

Create a new user account.

Endpoint

POST /api/v1/register

Request Body

Prop

Type

Example Request

{
  "email": "[email protected]",
  "password": "SecurePass123!",
  "password_confirmation": "SecurePass123!",
  "name": "John Doe",
  "country": "United States"
}

Response

{
  "status": "SUCCESS",
  "message": "Registration successful. Please verify your email."
}

Email Verification

Resend the email verification link to a user.

Endpoint

GET /api/v1/email/verify-resend

Headers

Authorization: Bearer YOUR_ACCESS_TOKEN

Response

{
  "status": "SUCCESS",
  "message": "Verification email sent successfully"
}

Forgot Password

Request a password reset link.

Endpoint

POST /api/v1/forgot-password

Request Body

{
  "email": "[email protected]"
}

Response

{
  "status": "SUCCESS",
  "message": "Password reset link sent to your email"
}

Reset Password

Reset user password using the token from the forgot password email.

Endpoint

POST /api/v1/reset-password

Request Body

Prop

Type

Example Request

{
  "token": "reset_token_from_email",
  "email": "[email protected]",
  "password": "NewSecurePass123!",
  "password_confirmation": "NewSecurePass123!"
}

Response

{
  "status": "SUCCESS",
  "message": "Password reset successfully"
}