Update access token generation to return more useful class
This commit is contained in:
parent
fdd90b3be7
commit
9e0ec8fca8
4 changed files with 32 additions and 9 deletions
|
@ -37,12 +37,12 @@ class ApiKeyController extends ClientApiController
|
|||
|
||||
// TODO: this should accept an array of different scopes to apply as permissions
|
||||
// for the token. Right now it allows any account level permission.
|
||||
[$token, $plaintext] = $request->user()->createToken($request->input('description'));
|
||||
$token = $request->user()->createToken($request->input('description'));
|
||||
|
||||
return $this->fractal->item($token)
|
||||
return $this->fractal->item($token->accessToken)
|
||||
->transformWith(PersonalAccessTokenTransformer::class)
|
||||
->addMeta([
|
||||
'secret_token' => $plaintext,
|
||||
'secret_token' => $token->plainTextToken,
|
||||
])
|
||||
->toArray();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ namespace Pterodactyl\Http\Requests\Api;
|
|||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @method \Pterodactyl\Models\User user($guard = null)
|
||||
*/
|
||||
abstract class ApiRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue