To login into Salesforce using Google credentials, use the below steps
1. Go to “https://console.developers.google.com/project“.
2. Click “Create Project”.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/createproject.png)
3. Enter project name and click “Create”.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/createapp.png)
4. Go to “Credentials” and click “Create new Client ID”.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/createnewclientID.png)
5. Select “Web Application”, remove default in “AUTHORIZED JAVASCRIPT ORIGINS” and click “Create Client ID”.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/webapplication.png)
6. Go to “Consent Screen” and enter the Product Name.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/consentscreen.png)
7. Go to your Salesforce.com Setup –> Administer –> Security Controls –> Auth. Providers and click “New”.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/newauth.provider.png)
8. Enter the details as below.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/saveauth.provider.png)
In order to get the Consumer Key and Consumer Secret, get Client Id and Client Secret from your Google Project.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/consumerkeyandsecret.png)
9. Copy the Callback URL from Auth. Provider and paste it in Redirec URI.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/callbackurl.png)
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/editsettings.png)
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/updatecallbackurl.png)
10. An apex class would have been created. Go to Setup –> Build –> Develop –> Apex Classes and edit the class as mentioned below.
global class AutocreatedRegHandler1406191530150 implements Auth.RegistrationHandler {
global User createUser(Id portalId, Auth.UserData data) {
User u = [SELECT Id FROM User WHERE Email =: data.email];
return u;
}
global void updateUser(Id userId, Id portalId, Auth.UserData data) {
}
}
here you can make use of data.FirstName, data.LastName, data.FullName, openid(Google Profile Id) also.
11. Copy the Test-Only authrorization url and paste it in your brower and press enter.
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/googlelogin.png)
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/requestforpermission.png)
![](https://www.infallibletechie.com/wp-content/uploads/2014/07/testonlyauthorization.png)
12. Provide Single Sign-On Initialization URL to your organization user to login into Salesforce using Google credentials.
Note: Sometimes, it will get some time to get synchronized. If you get any error in the URL, kindly try after sometime.