Skip to content
Advertisement

Tag: jwt

How to implement authentication & authorization between microservices & API Gateway using Laravel

I’m trying to implement authentication & authorization of users between my microservices and API Gateway.What I have now: API Gateway which can request to any microservice. User microservice – where I’m storing all users. laravel/passport implemented to authenticate user in this microservice. Works as it should be, login route returns token which I’m using to authenticate user in this microservice.

Failed Login with Tymon JWT Auth Laravel 8

When I try to get token with login function I get this error TypeError: Argument 1 passed to TymonJWTAuthJWTGuard::login() must be an instance of TymonJWTAuthContractsJWTSubject, instance of AppModelsUser given, called in …vendortymonjwt-authsrcJWTGuard.php on line 127 in file …vendortymonjwt-authsrcJWTGuard.php on line 140 Here my login function: Here my User model: How to solve my issue? Answer You must implement TymonJWTAuthContractsJWTSubject contract

Error 401 after successful login to Laravel using jwt

In my Laravel project, I use jwt for user authentication.I successfully login and receive the token. I send the token with the Barear prefix in the header but I get a 401 error.Meanwhile, my project works well on localhost, but it has this problem on cpanel hosts.My codes are below in config/auth.php and in configjwt.php ]; my web route: my

How to call a class from vendor folder when using a composer?

I am investigating jwt token examples from this link – https://github.com/firebase/php-jwt So i run: And now i have new files and folders in my root directory of my site: vendor, composer.json and composer.lock. Folder “vendor” contents “firebase/php-jwt” folder. So i tried to run an example script inside my root site’s folder (test.php, for example) with this content: And when i

Check JWT (Firebase) Token with Symfony 5.3

I’m working on an API, and I had implemented a JWT to make it stateless. I created an AuthController, which returns a JWT when login information is correct. Here you can see the return code that generates the token: This is the result when I run the authenticate method, un the URL localhost:8000/authenticate. Now, what I would need to do

jwt token not found when i pass in username and password in curl

I want to use jwt token in my symfony project. But i have a problem because when i use: curl.exe -X POST -H “Content-Type: application/json” http://localhost:81/api/login_check -d ‘{“username”: “f.djawid@outlook.com”,”password”:”000000″}’ I get : {“code”:401,”message”:”JWT Token not found”} This is my security.yml: As you can see i use the lexikJWTAthenticationBundle. I made a private key and public key with ssl. I use

I can’t get JWT token in Laravel

I am creating an API in Laravel 8 (PHP 7.4) and I wanted to secure it. The choice fell on tymon / jwt-auth. I follow the documentation from the website: https://jwt-auth.readthedocs.io/en/develop/quick-start/ Everything works fine here. However, later when I create a route to login and want to get the token using auth()->attempt(), I have the following error: Undefined method ‘attempt’.

PHP get JSON Web Token with Guzzle

I use Laravel 5.3 with GuzzleHttp 7 and want to make an API-Call to another Server in order to authorize and get a JSON Web Token in return. The curl command runs perfectly fine and returns a JSON Web Token with status code 200: In PHP: Answer I have made small changes to your code to make it more better,

PHP JWT (JSON Web Token) with RSA signature without library

Anyboby know some solution in PHP to using JWT (JSON Web Token) with RSA signature without library? I tried so hard to find solutions without library or without using composer. All the options that I found use some kind of library. Answer I made my own solution using other examples on the way. Below we have 3 use cases and

Advertisement