Announcement

Collapse
No announcement yet.

User self registration with Google Sign-in

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • User self registration with Google Sign-in

    I need help in implementing self user registration with Google Sign-in (javascript api). This will be crm user not portal user. Then after registration auto login that user in crm.

  • #2
    Likely you need to obtain google api key for your website/app, find a php oauth library, add it to espo using composer, set the "redirect/login" url (from google app oauth configuration page) to a custom entrypoint from which you invoke the oauth library to handle the login: silently create the user entity if it does not exist or log in the user automatically (replicate the code from core auth class). There may be easier ways but idk.
    Last edited by tothewine; 06-21-2020, 12:20 PM.

    Comment


    • attachaudhury
      attachaudhury commented
      Editing a comment
      Thanks @tothewine,
      I was thinking another flow for google sign in , that is ->
      1. Create a "Signin with Google" button in loginView. Click on this button will open google authentication popup. After the user authenticate crm. The email and other information will be available on loginView (frontend).
      2. After this send ajax request from loginView(frontend) to custom controller(backend) and create user entity there.
      Is there any flaws in this logic ?

    • tothewine
      tothewine commented
      Editing a comment
      yeah about the frontend modifications you need to edit the login to add the button to start the oauth sequence with google. after the last step you are left with the access token in the client code

  • #3
    Here is an example: https://developers.google.com/identity/sign-in/web

    at the end of the success event handler you do the ajax request with the data to your custom php code that creates an user entity (first time) and logs in the user.
    Last edited by tothewine; 06-22-2020, 01:48 PM.

    Comment


    • attachaudhury
      attachaudhury commented
      Editing a comment
      Yes same logic I applied and it is successful. Thanks

    • tothewine
      tothewine commented
      Editing a comment
      you're welcome. great! if you want to share any tips or problems you faced for future users it will benefit the whole community
Working...
X