tappleby / laravel-auth-token

Hooks into the laravel auth module and provides an auth token upon success. This token is really only secure in https environment. This main purpose for this module was to provide an auth token to javascript web app which could be used to identify users on api calls.
MIT License
255 stars 64 forks source link

How To document #43

Open bingalls opened 10 years ago

bingalls commented 10 years ago

Seed your User table: http://laravel.com/docs/migrations

php artisan serve # In your first terminal

php artisan tinker # http://laravel-recipes.com/recipes/280

$user = User::find(1); $authToken = AuthToken::create($user); $publicToken = AuthToken::publicToken($authToken);

//Test a valid token

$login = AuthToken::driver()->validate($publicToken); print_r($login);

//Test an invalid token

$bad = AuthToken::driver()->validate('badToken'); print_r($bad);

exit;

jahsome commented 9 years ago

Thanks for sharing -- this was pretty helpful in attempting to wrap my head around this package!