Mautic Community Forums

Unable to get auth codes for OAuth2 api calls

I am familiar with API development and OAuth specifically but running into some early issues trying to write backend integration to Mautic. I have a website (in Drupal 7) that is accepting user signups and some other email collection points. This data needs to be moved to a new Mautic installation to manage outbound campaigns. The process to do this against the old mail system was an hourly job to identify new signups and push them to the 3rd party. I am trying to replicate this using https://github.com/mautic/api-library.



I have the api enabled in settings and have defined a client for this cli process. My goal is to manually generate an initial auth and refresh token and then have the cli script manage any refresh, writing the tokens to a config file in case they change - which they will every hour or so.



I am getting 404’s though when accessing the following URL which I pulled from https://github.com/mautic/developer-documentation/blob/master/source/includes/_api_authorization_oauth2.md



/oauth/v2/authorize?client_id=ID&grant_type=authorization_code&redirect_uri=URL&response_type=code

Is using the API overkill for this level of internal integration and if so, is there an easier approach?

I am familiar with API development and OAuth specifically but running into some early issues trying to write backend integration to Mautic. I have a website (in Drupal 7) that is accepting user signups and some other email collection points. This data needs to be moved to a new Mautic installation to manage outbound campaigns. The process to do this against the old mail system was an hourly job to identify new signups and push them to the 3rd party. I am trying to replicate this using https://github.com/mautic/api-library.

I have the api enabled in settings and have defined a client for this cli process. My goal is to manually generate an initial auth and refresh token and then have the cli script manage any refresh, writing the tokens to a config file in case they change - which they will every hour or so.

I am getting 404’s though when accessing the following URL which I pulled from https://github.com/mautic/developer-documentation/blob/master/source/includes/_api_authorization_oauth2.md

/oauth/v2/authorize?client_id=ID&grant_type=authorization_code&redirect_uri=URL&response_type=code
Is using the API overkill for this level of internal integration and if so, is there an easier approach?

I get error also when it tries to go to /oauth/v2/authorize? I get HTTP 403, I’ve installed API library i.e /lib folder from github but still get this error