You need to sign in to do that
Don't have an account?
Priyankar Pakhira 23
Single Sign On error in OpenID connection between Google and Salesforce
Hi
I am going to do Single Sign On setup through OPEN ID connect with Google+. Wheras Salesforce is acting as a Service Provider and Google as a Identity Provider. Now when I am trying to login through Salesforce it redirects me to Google Account but after Submitting the google credential it is throwing below error
We can’t log you in because of the following error. For more information, contact your Salesforce administrator.
Missing_Value: Could not find unique third-party identifier
Please can you let me know if I am doing anything wrong. Please find below the Registration Handler class below
global class GoogleEnterpriseSignOn implements Auth.RegistrationHandler{
global boolean canCreateUser(Auth.UserData data) {
if(data.email!=null) // this null checking is just for demo purpose
{
return true;
}
else
{
return false;
}
}
global User createUser(Id portalId, Auth.UserData data){
if(canCreateUser(data))
{
List<User> users = [select Id from User where Google_ID__c=:data.identifier];
if(users.size()==1)
{
system.debug('#1##'+users[0]);
return users[0];
}
else
{
User u = new User();
Profile p = [SELECT Id FROM profile WHERE name='System Administrator'];
u.username = data.email.substring(0,data.email.indexOf('@'))+ '@sso.com';
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
String alias = data.firstName.substring(0,1)+data.lastName.substring(0,4);
if(alias.length() > 8) {
alias = alias.substring(0, 8);
}
u.alias = alias;
u.languagelocalekey = 'en_US';
u.localesidkey = 'en_US';
u.emailEncodingKey = 'UTF-8';
u.timeZoneSidKey = 'America/Los_Angeles';
u.profileId = p.Id;
u.Google_ID__c = data.identifier;
System.debug('+++++'+u);
insert u;
return u;
}
}
else
{
return null;
}
}
global void updateUser(Id userId, Id portalId, Auth.UserData data){
User u = new User(Id=userId);
u.Google_ID__c = data.identifier;
update u;
}
}
I am going to do Single Sign On setup through OPEN ID connect with Google+. Wheras Salesforce is acting as a Service Provider and Google as a Identity Provider. Now when I am trying to login through Salesforce it redirects me to Google Account but after Submitting the google credential it is throwing below error
We can’t log you in because of the following error. For more information, contact your Salesforce administrator.
Missing_Value: Could not find unique third-party identifier
Please can you let me know if I am doing anything wrong. Please find below the Registration Handler class below
global class GoogleEnterpriseSignOn implements Auth.RegistrationHandler{
global boolean canCreateUser(Auth.UserData data) {
if(data.email!=null) // this null checking is just for demo purpose
{
return true;
}
else
{
return false;
}
}
global User createUser(Id portalId, Auth.UserData data){
if(canCreateUser(data))
{
List<User> users = [select Id from User where Google_ID__c=:data.identifier];
if(users.size()==1)
{
system.debug('#1##'+users[0]);
return users[0];
}
else
{
User u = new User();
Profile p = [SELECT Id FROM profile WHERE name='System Administrator'];
u.username = data.email.substring(0,data.email.indexOf('@'))+ '@sso.com';
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
String alias = data.firstName.substring(0,1)+data.lastName.substring(0,4);
if(alias.length() > 8) {
alias = alias.substring(0, 8);
}
u.alias = alias;
u.languagelocalekey = 'en_US';
u.localesidkey = 'en_US';
u.emailEncodingKey = 'UTF-8';
u.timeZoneSidKey = 'America/Los_Angeles';
u.profileId = p.Id;
u.Google_ID__c = data.identifier;
System.debug('+++++'+u);
insert u;
return u;
}
}
else
{
return null;
}
}
global void updateUser(Id userId, Id portalId, Auth.UserData data){
User u = new User(Id=userId);
u.Google_ID__c = data.identifier;
update u;
}
}
Trung Nguyen 41
FYI, it appears I have to enabled "Send access token in header". With that it work, not sure if it's an Okta issue or Salesforce.
System System
hi priyankar, did you ever resolve this issue?