Tuesday, March 21, 2017

Using Laravel Passport with a Load Balancer

In my Laravel app, I'm using Passport's Password Grant to give API access to an iOS application.

In my production environment, I'm also using one load balancer to distribute requests to two servers. All have been created in forge.

I can use the Password Grant token to authenticate a user via iOS, and have the API return the bearer access_token. However, the load balancer then ships the next request to the other server, which seems not to recognize the access_token, and so throws a 401.

Question #1: Does anyone have experience using Passport with a load-balanced environment? If so, did you run into this issue?

Question #2: Where is the access_token stored? I see it referenced within my database via an ID, but the token itself isn't stored there. Without, I'm not sure how to persist from server to server.



via Cameron Scott

Advertisement