function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Francois CombeauFrancois Combeau 

Set up social sign-up - Could not find a login to your community using Google.

1) I used use Module3RegistrationHandler.cls as registration handler.
2) I selected Google as login capability for Partners ( cf screenshot below)
However, the challenge fails with the following message :
Challenge Not yet complete... here's what's wrong:  Could not find a login to your community using Google.
Anybody can help ?
Thanks :-)
"Login & Registration" page
Best Answer chosen by Francois Combeau
SandhyaSandhya (Salesforce Developers) 
Hi Francois Combeau,

Check if you can log into the community using Google sign on the login page.

And also please consider this point in the same trailhead unit.

From Setup, enter All Communities in the Quick Find box, then select All Communities and click Manage next to the Customers community.
Select Administration, then Login & Registration and you see that Google is now an option.

Select Google and click Save.
To confirm your change, return to your private (incognito) browser and reload the login page. Check that the Google icon appears on the login page.

Hope this helps you!

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.

Thanks and Regards
Sandhya

 

All Answers

SandhyaSandhya (Salesforce Developers) 
Hi Francois Combeau,

Check if you can log into the community using Google sign on the login page.

And also please consider this point in the same trailhead unit.

From Setup, enter All Communities in the Quick Find box, then select All Communities and click Manage next to the Customers community.
Select Administration, then Login & Registration and you see that Google is now an option.

Select Google and click Save.
To confirm your change, return to your private (incognito) browser and reload the login page. Check that the Google icon appears on the login page.

Hope this helps you!

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.

Thanks and Regards
Sandhya

 
This was selected as the best answer
Francois CombeauFrancois Combeau
Dear Sandhya,
Thanks for you answer which helps. However, I suspect an error in the Challenge description :
"Login to the "Partner" community using your Google account."
should be
"Login to the "Customer" community using your Google account."
SandhyaSandhya (Salesforce Developers) 
Ok so did you pass the challenge now.If you feel its an error, you can provide feedback by clicking Feedback button on left side of the page in the same unit.
jihane messoudi 7jihane messoudi 7
Hi Sandhya , I still have this error when I want to sign in to Google via the Community in the Uncognito Window:
"We can’t log you in because of the following error.
REGISTRATION_HANDLER_ERROR: List has no rows for assignment to SObject". and Error Challenge: Challenge Not yet complete... here's what's wrong:  Could not find a login to your community using Google.

For information,
1) I used use Module3RegistrationHandler.cls as registration handler.
2) I selected Google as login capability for Partners 

Could you help please? Thanks in advance.
 
JosherPackJosherPack
Francois,

Thanks for the tip.  I got the same error when I tried logging into the Partner community with my google account.  However, based on your comment above, I tried to log into the Customer community with my Google account, and it succeded, and passed the challenge. 

Thanks,

Josh
ToriSansomToriSansom

Hi, I am still having this issue. My error message is: We can’t log you in because of the following error.
REGISTRATION_HANDLER_ERROR: List index out of bounds: 0

When I looked at the Apex code provided for the Registration Handler in order to complete the module it seems it is for facebook rather than Google, is this the issue? 

https://github.com/salesforceidentity/IdentityTrail-Module3/blob/master/Module3RegistrationHandler.cls

SandhyaSandhya (Salesforce Developers) 
Hi ToriSansom,

Try  to log into the Customer community with your Google account and see.


Hope this helps you!

Thanks and Regards
Sandhya



 
ToriSansomToriSansom
No, it's not an issue with my google account as I mentioned. Is anyone else having this same issue? It's driving me crazy
Jihane MessoudiJihane Messoudi

Hi ToriSansom,

I have the same issue and I change the Registration Handler as following and the challenge is passed and tell me if that help you.

//Set<String> s = new Set<String>{'usernamea', 'usernameb', 'usernamec'};
//if(s.contains(data.username)) {
//return true;
//}
return false;
}

    
global User createUser(Id portalId, Auth.UserData data){
    //The user is authorized, so create their Salesforce user
    String googleUser = data.email;

    User u = [SELECT Id, username, email, lastName, firstName, alias, languagelocalekey,
              localesidkey, emailEncodingKey, timeZoneSidKey, profileId
              FROM User WHERE username = :googleUser];

    return u;
}
    
/* old method
global User createUser(Id portalId, Auth.UserData data){
if(!canCreateUser(data)) {
//Returning null or throwing an exception fails the SSO flow
return null;
}
if(data.attributeMap.containsKey('sfdc_networkid')) {
//We have a community id, so create a user with community access
//TODO: Get an actual account
Account a = [SELECT Id FROM account WHERE name='Acme'];
Contact c = new Contact();
c.accountId = a.Id;
c.email = data.email;
c.firstName = data.firstName;
c.lastName = data.lastName;
insert(c);

//TODO: Customize the username and profile. Also check that the username doesn't already exist and
//possibly ensure there are enough org licenses to create a user. Must be 80 characters or less.
User u = new User();
Profile p = [SELECT Id FROM profile WHERE name='Customer Portal User'];
u.username = data.username + '@acmecorp.com';
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
String alias = data.username;
//Alias must be 8 characters or less
if(alias.length() > 8) {
alias = alias.substring(0, 8);
}
u.alias = alias;
u.languagelocalekey = UserInfo.getLocale();
u.localesidkey = UserInfo.getLocale();
u.emailEncodingKey = 'UTF-8';
u.timeZoneSidKey = 'America/Los_Angeles';
u.profileId = p.Id;
u.contactId = c.Id;
return u;
} else {
//This is not a community, so create a regular standard user
User u = new User();
Profile p = [SELECT Id FROM profile WHERE name='Standard User'];
//TODO: Customize the username. Also check that the username doesn't already exist and
//possibly ensure there are enough org licenses to create a user. Must be 80 characters
//or less.
u.username = data.username + '@myorg.com';
u.email = data.email;
u.lastName = data.lastName;
u.firstName = data.firstName;
String alias = data.username;
//Alias must be 8 characters or less
if(alias.length() > 8) {
alias = alias.substring(0, 8);
}
u.alias = alias;
u.languagelocalekey = UserInfo.getLocale();
u.localesidkey = UserInfo.getLocale();
u.emailEncodingKey = 'UTF-8';
u.timeZoneSidKey = 'America/Los_Angeles';
u.profileId = p.Id;
return u;
}
}
*/
global void updateUser(Id userId, Id portalId, Auth.UserData data){
User u = new User(id=userId);
//TODO: Customize the username. Must be 80 characters or less.
//u.username = data.username + '@myorg.com';
//u.email = data.email;
//u.lastName = data.lastName;
//u.firstName = data.firstName;
//String alias = data.username;
//Alias must be 8 characters or less
//if(alias.length() > 8) {
//alias = alias.substring(0, 8);
//}
//u.alias = alias;
update(u);
}
}
 
ToriSansomToriSansom
Thank you!!! I just tried it out and I'm currently seeing this error:
Apex Class Error

 
Arnaud SourdillonArnaud Sourdillon
Hello,
I am still having this issue when i tried to complete the challenge of "Set up social sign-up" with google
Apex code on Github seems not work properly.

does anyone have solution ?

REGISTRATION_HANDLER_ERROR: List has no rows for assignment to SObject
Ian Cruzen2Ian Cruzen2
I too am still having trouble with this. Have tried a few different things but no luck.... same error as posted above...
Trev RaicesTrev Raices
Challenge Not yet complete... here's what's wrong:
Could not find a login to your community using Google.

I can't get past this, it's driving me nuts!! 4 days now...can anyone solve this?
Sai Kumar 449Sai Kumar 449
Hi Guys i Passed this Challange but using some tips but its not Exact to Parters login its in to Customers Login 

Here are the Steps i have Done 

Step 1. As we have come the Customers Community portal r8 :)

 you can log into the community using facebook sign on the login page.

Step 2 is Open the Customers portal and click or Enable the Google there and Try to register with Google u vl b logged in and click on the Check Challange ................ your Challange wil ppbe assed 

Thanks
Saikumar.N
Ethan WillerEthan Willer
This trailhead needs to be updates so it provides people with the CORRECT INSTRUCTIONS to complete the challenge. The typo in the instructions is really screwing people up here (myself included)

To be clear: It asks you enable google auth for the "Partner" community, but you need to enable it for the "customers" community that you created through the module, and then google auth to that.
Valerio VerdeValerio Verde
I hit the same problem and debugged the Apex code to see where is the problem.

It seems that the problem is in this line: 
private static final String TZSID = [SELECT timezonesidkey from User where profile.name = 'System Administrator' LIMIT 1].timezonesidkey;
Executing the SOQL, it returns 0 records.

Change the line with 
private static final String TZSID = [SELECT timezonesidkey from User where profile.name = 'Partners' LIMIT 1].timezonesidkey;
solved the "REGISTRATION_HANDLER_ERROR: List has no rows for assignment to SObject" for me.

Hope it helps.

Happy Trailheading :)
Eddie_TractionEddie_Traction
Per the comment above I removed the Timezonesidkey line and updated the create to use a static timezone 
u.timeZoneSidKey = 'Pacific/Kiritimati';
additionally I updated line 8 to
private static final String EXTERNAL_USER_PROFILE = 'Partner Community User';
I'm not a coder... but it seems to work now :)
Vilmarir Pagan 9Vilmarir Pagan 9
I'm going to put this here in case here, in case it works for anyone else.

I noticed that in the code the static string is called for an Account called Partners and a user profile called Partners. see code below! But! in the trailhead, the instructions stated to create a customer profile, and account.

I clone the external profile and named it partners, created an account called partners, and assigned them access in the community. That worked for me.

rivate static final String ORG_SUFFIX = '.sso.badge.org';
private static final String DEFAULT_ACCOUNTNAME = 'Partners';
private static final String EXTERNAL_USER_PROFILE = 'Partners';

private static final String INTERNAL_USER_PROFILE = 'Standard User';
private static final String TZSID = [SELECT timezonesidkey from User where profile.name = 'System Administrator' LIMIT 1].timezonesidkey
Kumar gautam 33Kumar gautam 33
Hi All,
I had the same error. The way to fix that is to log in to your google account and keep the session open. then please try launching the trailhead challenge. You dont have to create a new community but make sure your Social sign on using google account session is active. thanks
Yogendra Singh AttriYogendra Singh Attri
Hi All, 

I get the below error while enbaling Social Sign on. 

We can’t log you in because of the following error.
NO_ACCESS: User was not authorized for the community


Please help.

Thank You
Yogendra.
manhatmamanhatma

For me worked that solution, i was missing this part.. in video link starts in 8:34, you will need to configure Domain in quick find as it shows and select google.

https://youtu.be/TT3s5kPD86o?t=514

 

If you have problem with authentication or you dont find communities in quick find..

Bram Raatjes 9Bram Raatjes 9
The error 'NO ACCESS: user not found' can also be caused if you're trying to verify using a Google account that does not have a surname. 
M PravalikaM Pravalika
Hi I found the cause for the Error "We can’t log you in because of the following error.
NO_ACCESS: Unable to find a user" caused in Setup Social-Sign-On for Google.
1.The 'Module3RegistrationHandler' Registration Handler Apex class should not have first name ,last name and email as null for the google account you are trying to use.Especially LastName-> Google Account->Personal Info->Name->Name->Edit->SurName.
Try using 'Test-Only Initialization URL'  in browser and check if First name, last name and email are not null and as below

<user>
<full_name>User Name</full_name>
<provider>Google</provider>
<org_id>00D5g00000KLFs0</org_id>
<id>104306240057043325514</id>
<portal_id>000000000000000</portal_id>
<locale>en-GB</locale>
<first_name>someName</first_name>
<last_name>someName</last_name>
<email>Gmail@gmail.com</email>
</user>

Hope this helps.It worked for me 100%.