Authenticating Users via the EspoCRM API for External Application Login

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joostk
    Junior Member
    • Nov 2020
    • 21

    Authenticating Users via the EspoCRM API for External Application Login

    Hello everyone,

    I'm working on a project where I want to leverage the user credentials stored in my EspoCRM to authenticate users into an external application. Essentially, the idea is to let users log into a different application using their EspoCRM username and password.

    I've attempted to use the EspoCRM API for this purpose, but I'm running into some issues. I know that EspoCRM provides an API key-based method, which I've successfully used to fetch other types of data. But, when it comes to user authentication for an external login system, I'm a bit stuck.

    Has anyone else tried to do something similar? I'd really appreciate some pointers:
    1. Is the EspoCRM API designed to handle such authentication use cases?
    2. Are there specific API endpoints or methods I should be using?
    ​Thanks and take care!

    Joost
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    #2
    Hi there,

    On my end I did something like this (in Laravel)

    PHP Controller
    Click image for larger version

Name:	image.png
Views:	256
Size:	4.4 KB
ID:	97515

    $base64Auth is $authStr here
    PHP Service
    Click image for larger version

Name:	image.png
Views:	199
Size:	29.1 KB
ID:	97516

    You can do a cURL GET request and it will be the same​.
    $user will contain the user's data or nothing if the username / password aren't matching.

    Regards,
    Firyo.

    Comment

    Working...