/oc-jwt-auth

JSON Web Token Authentication plugin for OctoberCMS.

Primary LanguagePHP

JWT-Auth plugin

Build Status Scrutinizer Code Quality StyleCI

This plugin provides a simple means of authentication within OctoberCMS using JSON Web Tokens (spec).

It based on JSON Web Token Authentication for Laravel & Lumen by Sean Tymon.

Requirements

Installation

  • Extract this repository into plugins/autumn/jwtauth
  • In plugins/autumn/jwtauth folder run composer install.
  • Run php artisan vendor:publish --provider="Autumn\JWTAuth\ServiceProvider" command.
  • Run php artisan jwt:generate command.

Usage

This plugin provides the following api endpoints:

/api/auth/login

Expects 2 parameters to receive: email and password. It authenticates the user via their credentials, and returns a token corresponding to that user if succeeded.

/api/auth/register

Expects 3 parameters to receive: username, email and password. It tries to create a user and returns a token corresponding to that user if succeeded.

/api/auth/logout

Provide the basic logout functionality.