Ich habe ein Backend in Laravel und eine App in Ionic. Ich benutze satellizer auf der Frontend-Seite und this package auf der Laravel-Seite für JWT-Authentifizierung. Da ich Token für Benutzer haben muss, bis sie sich abmelden, brauche ich eine Möglichkeit, ihr Token irgendwie zu aktualisieren. Ich bin mir nicht sicher, wie das geht, wäre es besser, wenn alle Routen Auth-Token anfordern und eine 401-Antwort senden, wenn sie nicht vorhanden sind, dann Token aktualisieren oder ein Token mit Timer auf der Frontend-Seite auffrischen und wie man das macht ?Angular - aktualisieren JWT Token
Dies ist meine Routen-Datei:
Route::group(['jwt.auth', ['except' => ['authenticate']], 'prefix' => 'api', 'namespace' => 'Api'], function() {
Route::post('authenticate', '[email protected]');
Route::get('user', '[email protected]');
Route::get('comment', '[email protected]');
Route::get('articles/latest', '[email protected]');
Route::get('articles/by-score', '[email protected]');
Route::get('article/{id}', '[email protected]');
Route::get('comments', '[email protected]');
Route::get('comments/{id}', '[email protected]');
Route::post('comments/create', '[email protected]');
Route::put('comments/update', '[email protected]');
Route::delete('comments/delete', '[email protected]');
Route::post('article/upvote', '[email protected]');
Route::delete('article/upvote/delete', '[email protected]');
Route::post('article/challenge/vote', '[email protected]');
Route::delete('article/challenge/vote/delete', '[email protected]');
});