user(); File::ensureDirectoryExists(dirname(GmailClient::tokenPath())); File::put( GmailClient::tokenPath(), json_encode([ 'access_token' => $profile->token, 'refresh_token' => $profile->refreshToken, 'created' => now()->timestamp, 'expires_in' => $profile->expiresIn, 'email' => $profile->email, ]), ); if (settings('incoming_email.gmail.enabled')) { (new GmailClient())->watch(); } return (new Oauth())->getPopupResponse('SUCCESS', [ 'profile' => $profile, ]); } }