Last updated 9 months ago

Set up Google authentication

This article describe how you can set up google Oauth so your users can quickly login or register with their google account.

Setting up google Oauthtication with online trader can be tricky, however this guide describes how you can easily set up your system to use "Login with google functionality". Please follow along. 

  1. Visit google console and create a project, preferably with your application/website name as the name of the project in your console dashboard.
  2. Make sure your project is selected
  3. From the Sidebar Menu, click on APIs & Services > Credentials
  4. Make sure you create your OAuth 2.0 Client IDs and save the requried information space provided in your website 
  5. When creating your Client ID, enter any name of your choice in the Name field, preferably your website name
  6. Then in the Authorized JavaScript origins, enter your website url in the box provided. NOTE: even if your website is in a sub domain or sub folder, still enter the site address(main domain) eg http://example.com
  7. For Authorize redirect URLs, enter your callback url like so:  http://example.com/auth/google/callback NOTE: change the example.com to your website url. At this time, if your site is in a subDomain or subFolder make sure to include it in this url. eg for sub domain do  http://sub-domain.example.com/auth/google/callback and sub folder:  http://example.com/sub-folder/auth/google/callback
  8. And click on save.
  9. Copy your Client ID and Secret key and paste in textboxes provided in your website: App settings > Email/Google Login-Capcha
  10. Make sure you set the "Redirect URL" with the same value as the one in Step 7.
  11. Done.

 

You also need to set register the app in the OAuth Consent screen. 

  1. Click on the OAuth consent screen menu
  2. Enter the app name, your website name preferably.
  3. Enter your email address - can be any email address 
  4. Enter the application homepage eg http://example.com
  5. Enter the Authorize domains, eg example.com without the "https".
  6. Enter the developer contact email address -  can be any email you choose.
  7. Click save.

You are all set. Enable the google login from your app settings preference and test it out. 

If you encounter any error while doing so, please contact our support on skype.