https://github.com/code4mk/kauth
🔑 kauth is JWT API Authentication ( jwt-auth ) for laravel
https://github.com/code4mk/kauth
0devco auth code4mk jwt-auth kauth laravel laravel-api laravel-auth laravel-jwt
Last synced: about 2 months ago
JSON representation
🔑 kauth is JWT API Authentication ( jwt-auth ) for laravel
- Host: GitHub
- URL: https://github.com/code4mk/kauth
- Owner: code4mk
- Created: 2019-02-08T09:22:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-04T21:08:24.000Z (over 5 years ago)
- Last Synced: 2025-04-08T19:52:42.130Z (3 months ago)
- Topics: 0devco, auth, code4mk, jwt-auth, kauth, laravel, laravel-api, laravel-auth, laravel-jwt
- Language: PHP
- Homepage: https://code4mk.org/kauth/
- Size: 19.5 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# `kauth`
kauth is JWT API Authentication ( jwt-auth ) for laravel# Installation
you can install kauth package by command
```bash
composer require code4mk/kauth
```
# Setup### 1) Vendor publish.
```bash
php artisan vendor:publish --provider="Kauth\KauthServiceProvider" --tag=config
php artisan vendor:publish --provider="Kauth\KauthServiceProvider" --tag=migations
```
### 2) Config setup* `config\kauth.php`
* set `token_header_name` that you can use with guzzle or axios header
* default `token_header_name` name is `tokon`# Usage
## `Kauth::attempt()` functions
* guard('name')
```php
// guard name will be user table name
Kauth::guard("users")
```
* socialite()->attempt()
```php
// laravel socialite system
// credential will be only email
Kauth::guard("users")->socialite()
->attempt(["email"=>"[email protected]"]);
```
* normal attempt()
```php
// your all desired credentials
// password credentail need
Kauth::guard("users")
->attempt(["email"=>"[email protected]","password"=>1234])
```~ `attempt() return a jwt token` which you pass with request header (ex:axios header)
## attempt special* username credential will be optional as (id|email|username) . (ex: facebook username)
* `usernames` describe which columns you want to match for username```php
attempt(["usernames"=>["id","email","name"],"username"=>"request query for username","password=>123456"]);
```
## Kauth::check()```php
Kauth::check();
```
## Kauth::id()```php
Kauth::id();
```## Kauth::refreshToken()
```php
Kauth::refreshToken()
```## Kauth::logout()
```php
Kauth::logout();
```## Kauth::logoutOtherDevices()
```php
Kauth::logoutOtherDevices();
```