https://github.com/fadilxcoder/ci-jwt
JWT Authentication - CI3 - REST API - Mobile [https://github.com/fadilxcoder/jwt-mobile-app.git] - Desktop [https://github.com/fadilxcoder/php-desktop-app.git]
https://github.com/fadilxcoder/ci-jwt
ci3 notes php poc rest-api server
Last synced: 28 days ago
JSON representation
JWT Authentication - CI3 - REST API - Mobile [https://github.com/fadilxcoder/jwt-mobile-app.git] - Desktop [https://github.com/fadilxcoder/php-desktop-app.git]
- Host: GitHub
- URL: https://github.com/fadilxcoder/ci-jwt
- Owner: fadilxcoder
- Created: 2020-07-23T19:10:05.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-10-18T18:10:02.000Z (over 2 years ago)
- Last Synced: 2025-04-20T20:35:44.929Z (about 2 months ago)
- Topics: ci3, notes, php, poc, rest-api, server
- Language: PHP
- Homepage:
- Size: 560 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JWT Authentication - CodeIgniter 3 REST API
```php
# 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';```
- *Resource* : Tutorials (http://developer-city.com/jwt)
- *Resource* : Verify Signature (https://jwt.io/)
- *Resource* : PHP Package PHP-JWT (https://firebaseopensource.com/projects/firebase/php-jwt/)-------
# Public & Private Keys
- *Resource* : Tutorials (https://morioh.com/p/1e376919d0af)
- Generate a pair of keys here : http://travistidwell.com/jsencrypt/demo/ - **GUI Version**
- *Resource* : Console Key Generator (http://travistidwell.com/jsencrypt/)
- cmd : `openssl genrsa -out private.pem 1024` where *private.pem* is the private key file name
- cmd : `openssl rsa -pubout -in private.pem -out public.pem` get public key from private key
- *Files* : `keys/private.pem` & `keys/private.pem`-------
# JWT with Mobile App
- Send Public Key to server to check if CLIENT is VALID : `/index`
- Return Response if CLIENT is ALLOW or not.
- If CLIENT is ALLOW, send data to server to create JWT token : `/get-token`
- If CLIENT is ALLOW, send JWT token to server to verify and decode JWT token : `/verify-token`# Heroku Deploy
- Change CI *composer - vendor* (`vendor/autoload.php`) location
# Notes
- Download `cacert.pem` from https://curl.haxx.se/ca/cacert.pem
- `curl.cainfo="C:\wamp64\cert\cacert.pem"` in php.ini