You mean, I have to set redirect_uri just like from ‘Credentials’ window? If yes - it doesn’t help:( And about api tester, it also requires OAuth2 authentication, so request ‘https://mautic.infiniteriver.io/api-library/apitester/’ shows the same response
Hm. Try clearing you cache after saving to make sure the setting change took place properly. Also are you running 1.0.4 yet? It had some changes to the authentication process (mostly for twitter though).
I also read almost all php code related to authorization in api library, but I don’t see any mistakes in my URL (I’m not good in PHP but it looks like I’m doing the same stuff as api lib does)
Unfortunately, currently I have no access to PC where Mautic hosted. But I changed ‘Path to the cache directory’ from ‘%kernel.root_dir%/cache’ to ‘%kernel.root_dir%/cache1’ and save changes. Is this possible workaround for now? If yes - it didn’t help, same {"error":"access_denied","error_description":"OAuth2 authentication required"}
Hm… I even tried some external tools to get the access_token. Here is one of them
I created test user
and pass id and secret to the service above, and set https://www.runscope.com/oauth_tool/callback as callback url for ‘test’ user’s settings. But no luck, same "error_description":"OAuth2 authentication required"}
I tried your api tester with my mautic instance(you left the url on screenshot), but I get blank response for any requests, so I cannot evaluate if authorization was successful
Sorry I don’t know whats wrong with it! I still think it is cache related personally.
Just out of curiosity - what happens if you create a free mautic account at mautic.com, create endpoints, and try to authenticate them with your app? See if that works (that will tell us if your app code is functioning correctly). then we can troubleshoot from there.
I have same type of problem. I have to use the Oauth 2 that is required on the site i’m trying to place the Mautic api key on.
i’m adding screen shots to show step1, 2 and 3
I’ve just went through the same issue. After 3 days of debugging code and trying various ways of firing API calls I believe I’ve found the cause.
The problem is using /api in base URL of Mautic instance. Since in documentation, there is stated that:[quote]“Base API Endpoint: https://your-mautic.com/api”[/quote]
This can lead (mainly API greenhorns like me) to use this point also in authorization process.
The correct URL is without /api as follows: https://your-mautic.com/ from which is constructed https://your-mautic.com/oauth/v2... which is used when obtaining a token.
Maybe more explicit comment in API documentation don't use /api in baseUrl can prevent beginners from repeating the same mistake in future.
Great thanks for providing us with API Tester, I would never debug this without it.