Skip to content

Instantly share code, notes, and snippets.

@metadaddy
Created September 12, 2013 23:24
Show Gist options
  • Save metadaddy/6545150 to your computer and use it in GitHub Desktop.
Save metadaddy/6545150 to your computer and use it in GitHub Desktop.
Simplest possible registration handler for OpenID Connect login from Google.
global class GoogleInternalRegHandler implements Auth.RegistrationHandler{
global User createUser(Id portalId, Auth.UserData data){
User u = [SELECT Id FROM user WHERE GoogleID__c =: data.identifier];
return u;
}
global void updateUser(Id userId, Id portalId, Auth.UserData data){
}
}
@paolomangano
Copy link

Helped a lot in my use case.
I was quite confused since I couldn't get why I had to create a new user to make it work... but your snipped just showed my the way ;)
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment