DoSomething / gateway

:lock_with_ink_pen: An opinionated PHP REST API client.
MIT License
2 stars 0 forks source link

Tell Laravel's guard about updated access token. #115

Closed DFurnes closed 6 years ago

DFurnes commented 6 years ago

What's this PR do?

Laravel's guard keeps a $user instance cached so that multiple requests to Auth::user() don't hit the database each time. This means that we won't see any changes made to that user record until the following page load, however, unless we tell the user provider about it!

This pull request updates that cached user with Auth::setUser so that if we update a user's access token via the "refresh token" middleware, we'll get that new one on future calls to Auth::user().

How should this be reviewed?

I'll put up a PR to update Phoenix's dependencies after this is merged!

Checklist

weerd commented 6 years ago

Does it actually break anything?

weerd commented 6 years ago

image

Sorry, I thought you added this to the checklist as a question for some reason.

DFurnes commented 6 years ago

Oooh, gotcha - this shouldn't be a breaking change since the APIs used by our apps stay the same!