liamqma/auth-token

There is no license information available for the latest version (dev-master) of this package.

dev-master 2013-12-19 04:56 UTC

This package is not auto-updated.

Last update: 2024-05-21 00:00:10 UTC


README

It's a fork of https://github.com/tappleby/laravel-auth-token

Getting Started

Setup

Add the package to your composer.json

"require": {
	...
    "liamqma/auth-token": "dev-master"
}

Add the service provider to app/config/app.php

'Liamqma\AuthToken\AuthTokenServiceProvider',

Setup the optional aliases in app/config/app.php

'AuthToken' => 'Liamqma\Support\Facades\AuthToken',

Currently the auth tokens are stored in the database, you will need to run the migrations:

php artisan migrate --package=liamqma/auth-token

Usage

Generate Token

$user_id = 1;
$user_type = 'Accessor';
AuthToken::createToken($user_id,$user_type)

Validate Token

$result = AuthToken::validateToken($token);
if($result===TURE)
    ...

Get User Id after validation

$user_id = AuthToken::getUserId()