mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Return token ID in cli
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
52332bc9ed
commit
67ad24af08
|
@ -7,6 +7,7 @@ use Illuminate\Console\Command;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Laravel\Passport\TokenRepository;
|
use Laravel\Passport\TokenRepository;
|
||||||
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
|
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
|
||||||
|
use DB;
|
||||||
|
|
||||||
class GeneratePersonalAccessToken extends Command
|
class GeneratePersonalAccessToken extends Command
|
||||||
{
|
{
|
||||||
|
@ -71,7 +72,10 @@ class GeneratePersonalAccessToken extends Command
|
||||||
if ($this->option('key-only')) {
|
if ($this->option('key-only')) {
|
||||||
$this->info($user->createToken($accessTokenName)->accessToken);
|
$this->info($user->createToken($accessTokenName)->accessToken);
|
||||||
} else {
|
} else {
|
||||||
|
$token = DB::table('oauth_access_tokens')->where('user_id', '=', $user->id)->where('name','=',$accessTokenName)->orderBy('created_at', 'desc')->first();
|
||||||
|
|
||||||
$this->warn('Your API Token has been created. Be sure to copy this token now, as it will not be accessible again.');
|
$this->warn('Your API Token has been created. Be sure to copy this token now, as it will not be accessible again.');
|
||||||
|
$this->info('API Token ID: '.$token->id);
|
||||||
$this->info('API Token User: '.$user->present()->fullName.' ('.$user->username.')');
|
$this->info('API Token User: '.$user->present()->fullName.' ('.$user->username.')');
|
||||||
$this->info('API Token Name: '.$accessTokenName);
|
$this->info('API Token Name: '.$accessTokenName);
|
||||||
$this->info('API Token: '.$user->createToken($accessTokenName)->accessToken);
|
$this->info('API Token: '.$user->createToken($accessTokenName)->accessToken);
|
||||||
|
|
Loading…
Reference in a new issue