Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to authenticate #11

Open
inkas opened this issue Mar 7, 2018 · 7 comments
Open

Unable to authenticate #11

inkas opened this issue Mar 7, 2018 · 7 comments

Comments

@inkas
Copy link
Contributor

inkas commented Mar 7, 2018

Hi. I get an error while trying to authenticate. The error I am getting is:

UnexpectedResponseFormatException
The response returned is in an unexpected format
in OAuth.php (line 791)

It looks like it cannot generate an access token and I never get a record on the mautic_consumer table.

My env file settings:

MAUTIC_BASE_URL=https://mautic.localhost
MAUTIC_PUBLIC_KEY=ppp
MAUTIC_SECRET_KEY=sss
MAUTIC_CALLBACK=https://localhost/mautic/application/register

Mautic API Credential settings:

Authorization Protocol: OAuth 2
Name: my-app
Redirect URI: https://localhost

When I hit https://localhost/mautic/application/register and accept the app, I get redirected to the callback url with status and code parameters.

I am using Mautic v2.12.2, php 7.1.

One more question - why do this package requires mautic/api-library v2.1.1? Is the issue related to usage of old version of the mautic/api-library as v2.10.0 is out now?

@inkas
Copy link
Contributor Author

inkas commented Mar 7, 2018

The issue turned out to be because of missing CURLOPT_SSL_VERIFYHOST => false in OAuth.php file.

@princealikhan
Copy link
Owner

mautic/api-library provide service to interact with your mautic app.

@codewithyou
Copy link

how to update with official api

@codewithyou
Copy link

https://localhost/mautic/application/register and accept the app, I get redirected to the callback url with status and code parameters.

I got the same question

@inkas
Copy link
Contributor Author

inkas commented Oct 1, 2018

@codewithyou Mautic does not work locally. It requires a valid SSL.

@princealikhan
Copy link
Owner

princealikhan commented Oct 3, 2018 via email

@SvetoslavStefanov
Copy link

SvetoslavStefanov commented Jul 18, 2022

I'm having a similar problem for the past few days:

I'm using Mautic v4.4 with OAuth2 (there is no option for v1 or other) with Laravel 8.

My Laravel's settings are:
MAUTIC_PUBLIC_KEY=public_key
MAUTIC_SECRET_KEY=private_key
MAUTIC_BASE_URL="https://emails.domain.com"
MAUTIC_CALLBACK="https://domain.com/mautic/application/register"

When I hit "https://domain.com/mautic/application/register" it shows "Mautic App Already Register" and I do have a row in the "mautic_consumer" table.

But whenever I try to do any API request I get a 403 error. I'm trying to do a POST request to https://emails.domain.com/api/contacts/new , just to test the API. Tried it with GET https://emails.domain.com/api/contacts , but I got the same result - 403 Forbidden

I'm not sure if my Mautic's configuration is ok. In https://emails.domain.com -> API Credentials -> as a redirect URI I've entered "https://domain.com" - is this the correct value there?

I searched everywhere for "Mautic API 403", but there are literally no results on the topic.

ps: I managed to do the authentication & API requests by using the mautic/api-library code. So it seems that the problem is in this package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants