Mautic Community Forums

Seeing Login page with API

Hello,



I am trying to integrate Mautic with osTicket, but I cannot get the API working for me.



Whenever I make a call to the API, it asks for me to login… why am I seeing a login page when using an API? All I want is to automatically push new customers into Leads and add them to a List.



Also, whenever I DO login, it just takes me to the dashboard, NOT back to my callback URL.

I guess you are doing something wrong. Read the documentation: https://developer.mautic.org/#rest-api

Hello,

I am trying to integrate Mautic with osTicket, but I cannot get the API working for me.

Whenever I make a call to the API, it asks for me to login… why am I seeing a login page when using an API? All I want is to automatically push new customers into Leads and add them to a List.

Also, whenever I DO login, it just takes me to the dashboard, NOT back to my callback URL.

Hi,

Can I just ask, is there a way of implementing the API without user consent?
We are a small business with a couple of different systems and we are trying to push all new customer data into Mautic from a different system using your API. The employee should not see a Mautic authentication screen, the process should be automatic. I don’t think the API can do exactly what I want, can you clarify please?

The API works for me when it is not implemented into the system and is called from a test.php page, but once implemented, it just redirects to the Mautic login screen, which the employee should not be seeing. Can I not just make calls to the API using an API Key as we’re not making a plugin/app for the user to use, it’s just used for systematic purposes.

Mautic API uses standard OAuth1 and/or OAuth2. If API would be available without any authentication, anyone would be able to read/update/create/delete anything within your Mautic from anywhere. I hope it is clear why the authentication is required.

The authentication has to be done once by an administrator and it will return an access token which can be used to access Mautic API without need to authenticate again (unless the refresh token expires). So if implemented correctly, the API calls will run without need to authenticate again and again.

If you just want to create/update new leads in Mautic, use
https://medium.com/@jan_linhart/the-simplest-way-how-to-submit-a-form-data-to-mautic-1454d3afd005

Related to this: when the token expires, and the refresh token also expires, it will be needed to authenticate again on Mautic authentication screen for next API calls right? There is no way of overcoming this behaviour, is there?

So if I want by all means to avoid users (who are not admins of my website) to see the Mautic authentication screen, I shall set the refresh token to a very big value, like 365 days for example? (that doesn’t sound quite a proper way of doing things though, does it?)