Created
April 10, 2012 21:40
-
-
Save pjagielski/2354774 to your computer and use it in GitHub Desktop.
getProfile
This file contains 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
OAuthProfile getProfile(OAuthService authService, Token accessToken) { | |
OAuthRequest request = new OAuthRequest(Verb.GET, 'https://www.googleapis.com/oauth2/v1/userinfo') | |
authService.signRequest(accessToken, request) | |
def response = request.send() | |
def user = JSON.parse(response.body) | |
def login = "${user.given_name}.${user.family_name}".toLowerCase() | |
new OAuthProfile(username: login, email: user.email, uid: user.id, picture: user.picture) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment