Expired page Laravel, why?

0

I'm creating an api here, for some reason I get this message

"The page has expired due to inactivity. 

Please refresh and try again."

Follow Controller

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use JWTAuth;
use App\User;
use JWTAuthException;
class UserController extends Controller
{
    private $user;
    public function __construct(User $user){
        $this->user = $user;
    }

    public function register(Request $request){

        $user = $this->user->create([
            'name' => $request->get('name'),
            'email' => $request->get('email'),
            'password' => bcrypt($request->get('password'))
        ]);
        return response()->json(['status'=>true,'message'=>'User created successfully','data'=>$user]);
    }

    public function login(Request $request){
        $credentials = $request->only('email', 'password');
        $token = null;
        try {
            if (!$token = JWTAuth::attempt($credentials)) {
                return response()->json(['invalid_email_or_password'], 422);
            }
        } catch (JWTAuthException $e) {
            return response()->json(['failed_to_create_token'], 500);
        }
        return response()->json(compact('token'));
    }
    public function getAuthUser(Request $request){
        $user = JWTAuth::toUser($request->token);
        return response()->json(['result' => $user]);
    }
}

The routes are like this

Route::prefix('api/v1/')->group(function () {

    Route::post('register', 'UserController@register');

    Route::group(['middleware' => 'jwt.auth'], function () {
        Route::get('user', 'UserController@getAuthUser');
    });

});

And the error I get is like this

DETAIL: A file is being created in Storage / framework / session every connection I make, for example, if I connect via PostMan it creates one, if I connect via another Chrome and so on!

How to solve?

    
asked by anonymous 06.09.2017 / 02:19

0 answers