Created
July 18, 2016 03:02
-
-
Save phamngsinh/cc09716a77290f9401463f703d725ec0 to your computer and use it in GitHub Desktop.
Refresh token in laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Step 1: | |
| install https://github.com/oriceon/oauth-5-laravel | |
| Step 2 : | |
| get token and follow the instructions: https://github.com/oriceon/oauth-5-laravel | |
| Step 3 : | |
| token expired and should reset | |
| $user = User::find($userId); | |
| $token_interface = new \OAuth\OAuth2\Token\StdOAuth2Token($google_token, $google_refresh_token); | |
| $googleService = \OAuth::consumer('Google'); | |
| $token = $googleService->refreshAccessToken($token_interface); | |
| $user->google_token = $token->getAccessToken(); | |
| $user->google_token_expire = $this->getProtectedValue($token, 'endOfLife'); | |
| $user->save(); | |
| return $user; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment