Questions tagged [laravel-jwt]

12 questions
13
votes
6 answers

How to enable both api and web guard in laravel

Laravel 5.7 PHP 7.2.10 Currently I am able to use any one of web and api guards, is there any way to allow both, so that both web app and api will work together. Something like return [ /* …
2
votes
3 answers

use laravel jwt authentication only for api without affecting web

I have an issue with authentication in laravel web, I only what to use the JWT authentication for the api only, I notice whenever I change guard in defaults to web 'guard' => 'web' and I try to login with postman using my api it will not work and…
delle
  • 213
  • 3
  • 15
2
votes
2 answers

Laravel Policy Always returns 403 unauthorized

I'm making an app that uses jwt as authentication system , when I try to update my Category model the policy always returns 403 unauthorized, I'm using apiResource to crud my model. my code in api.php: Route::apiResource('category',…
2
votes
0 answers

Laravel :How to authenticated user login with mobile number only and create jwt token for auth data

I am creating an API for my application using JWT. It is for different table not for users table. How can I authenticate login user with another table for exapmle students table and create jwt token. For the User table user authentication function…
Javed
  • 817
  • 4
  • 22
  • 44
0
votes
0 answers

How to call me function in laravel based jwt , Its giving 401 error when hit from my react application?

Below is my auth controller and api routes file login function is working well no issue in that but getting issue on me() function or /me post route please help me to solve it out. AuthController
Syed Saif
  • 13
  • 1
  • 6
0
votes
1 answer

Laravel jwt returns 500, on unauthorized

I use jwt for my api authentication. when I use wrong token it returns 500 and I get the error that rout login is not defiend! I'm using laravel 8 and "tymon/jwt-auth": "^1.0". my default guard is api and api driver is jwt. I tried name login route…
siavash
  • 11
  • 1
0
votes
1 answer

Allowing unauthenticated Users to Access Oath routes in Laravel Passport

I am making a Laravel application which will be issuing bearer token using Laravel Passport. So the idea is that a client who wants to use our system will come and register and create the Client_Secret and the Client_ID, then upon creating these…
0
votes
1 answer

laravel get sender http host with JWTAuth

I'm using tymondesigns/jwt-auth to create an api. And I need to get the URL of API request sender. So I wrote a middleware and used, public function handle($request, Closure $next) { dd(request()->getHttpHost()); } This gets…
vimuth
  • 5,064
  • 33
  • 79
  • 116
0
votes
0 answers

Laravel: JWT based authorization, Working in Postman but NOT in Browser

I'm integrating the JWT authentication with the Blog application in Laravel 5.6. I'm able to get the results in Postman. I'm trying to redirect to a view (post.blade.php), when the user is logged in but I'm unable to do the same in Browser. On…
0
votes
1 answer

API JWT guard and web session guard in Laravel

I am trying to make Laravel using multiple guards - depending on the authentication type. When I am authenticating via API, I would like to use jwt guard. When I am authenticating through web, I want to use session guard. My config\auth.php looks…
Bob
  • 8,392
  • 12
  • 55
  • 96
0
votes
1 answer

Laravel Jwt auth attempts returns false always

Hope you are doing well. ;) However, I m facing problems while generating JWT Auth Token we have a custom user table called somename_users where email field called email_id and we used md5 hash to store the password (don't judge). So first I tried…
Amiyo Ghosh
  • 47
  • 1
  • 8
0
votes
2 answers

Laravel API response Unauthenticated even when Authentication is passed

I am using the jwt for creating the tokens while login. After I login, I try to hit the /me api pointing to the function: public function me() { $user = auth()->user(); return response()->json($user); …