src/Laravel/LaravelOAuthBridge.php
public function persistUserToken(AccessToken $token)
    {
        $northstarId = $token->getResourceOwnerId();

        /** @var NorthstarUserContract $user */
        $user = $this->getUser($northstarId);

        // If user hasn't tried to log in before, make them a local record.
        if (! $user) {
            $user = $this->createModel();
            $user->setNorthstarIdentifier($northstarId);
        }

        // And then update their token details.
        $user->setOAuthToken($token);
        $user->save();

        // Finally, tell the guard about the new token if this is the currently
        // logged-in user. (Otherwise, they wouldn't get the new token until
        // the following page load.)
        if (auth()->user() && auth()->user()->getNorthstarIdentifier() === $northstarId) {
            auth()->setUser($user);
        }
    }
public function persistUserToken(AccessToken $token)
    {
        $northstarId = $token->getResourceOwnerId();

        /** @var NorthstarUserContract $user */
        $user = $this->getUser($northstarId);

        // If user hasn't tried to log in before, make them a local record.
        if (! $user) {
            $user = $this->createModel();
            $user->setNorthstarIdentifier($northstarId);
        }

        // And then update their token details.
        $user->setOAuthToken($token);
        $user->save();

        // Finally, tell the guard about the new token if this is the currently
        // logged-in user. (Otherwise, they wouldn't get the new token until
        // the following page load.)
        if (auth()->user() && auth()->user()->getNorthstarIdentifier() === $northstarId) {
            auth()->setUser($user);
        }
    }
public function persistUserToken ( AccessToken $ token ) { $ northstarId = $ token -> getResourceOwnerId ( ) ; /** @var NorthstarUserContract $user */ $ user = $ this -> getUser ( $ northstarId ) ; // If user hasn't tried to log in before, make them a local record. if ( ! $ user ) { $ user = $ this -> createModel ( ) ; $ user -> setNorthstarIdentifier ( $ northstarId ) ; } // And then update their token details. $ user -> setOAuthToken ( $ token ) ; $ user -> save ( ) ; // Finally, tell the guard about the new token if this is the currently // logged-in user. (Otherwise, they wouldn't get the new token until // the following page load.) if ( auth ( ) -> user ( ) && auth ( ) -> user ( ) -> getNorthstarIdentifier ( ) === $ northstarId ) { auth ( ) -> setUser ( $ user ) ; } }
Save the access & refresh tokens for an authorized user.

@param \League\OAuth2\Client\Token\AccessToken $token
@return void
Save the access & refresh tokens for an authorized user .