I am using Laravel 5.7 and Passport to provide OAuth authentication for an API hosting on Elastic Beanstalk. My problem is that since the load balancer has multiple instances, each instance has a different set of Oauth keys and hence when hitting an endpoint, the API is randomly (depending on which instance it hits) unauthenticated.
My solution to this is to store the keys on S3, and use Passport's loadKeysFrom
method to grab the keys from there.
The problem with this is that it seems to prepend the URL with file://
. This is my code:
Passport::loadKeysFrom(Storage::disk('s3')->url('/oauthkeys'));
This produces the error:
Key path "file://https://my-url.s3-eu-central-1.amazonaws.com/oauthkeys/oauth-private.key" does not exist or is not readable