Skip to content

fadilxcoder/ci-jwt

Repository files navigation

JWT Authentication - CodeIgniter 3 REST API

# Static app endpoints
$route['index'] = 'welcome/index';
$route['get-token'] = 'welcome/generateToken';
$route['verify-token'] = 'welcome/verifyToken';

# Desktop app endpoint
$route['api/index'] = 'api/index';
$route['api/request-jwt'] = 'api/requestJwt';
$route['api/send-jwt-for-verification'] = 'api/decodeJwt';
$route['api/api-bearer-verification'] = 'api/apiQueryVerifier';
$route['api/users-listings'] = 'api/usersLising';

Public & Private Keys


JWT with Mobile App

  • Send Public Key to server to check if CLIENT is VALID : <url-for-project-files>/index
  • Return Response if CLIENT is ALLOW or not.
  • If CLIENT is ALLOW, send data to server to create JWT token : <url-for-project-files>/get-token
  • If CLIENT is ALLOW, send JWT token to server to verify and decode JWT token : <url-for-project-files>/verify-token

Heroku Deploy

  • Change CI composer - vendor (vendor/autoload.php) location

Notes