Mautic Community Forums

How to map returned parametres to what API documentation says?

In API documentation, it is simply stated that:

Code:
/* // If you already have the access token, et al, pass them in as well to prevent the need for reauthorization $settings['accessToken'] = $accessToken; $settings['accessTokenSecret'] = $accessTokenSecret; //for OAuth1.0a $settings['accessTokenExpires'] = $accessTokenExpires; //UNIX timestamp $settings['refreshToken'] = $refreshToken; */

I have PHP script, which calls mautic and then mautic calls the script itself. I finally figured out how to make mautic write something else than "Callback is not valid." Now I am facing bigger issue. When the script is called again when returning from mautic, all I can see is this:

When returned back, I have two new GET parametres. Example:
Code:
oauth_token = 5maxsedwvz8k08oc4s4sggscggk04c808owg4kocg4c48kwc8s oauth_verifier = 2gdxm0o4ylgkgkgwssws48o80w8wsw0ckokgk0gg4gw44o88g8

I looked into HTTP headers in mozilla web developers tools and found nothing.

So, I give up and ask here: How should I map the above two GET parameters to the four what the API documentation says?


In API documentation, it is simply stated that:

/*
// If you already have the access token, et al, pass them in as well to prevent the need for reauthorization
$settings['accessToken']        = $accessToken;
$settings['accessTokenSecret']  = $accessTokenSecret; //for OAuth1.0a
$settings['accessTokenExpires'] = $accessTokenExpires; //UNIX timestamp
$settings['refreshToken']       = $refreshToken;
*/

I have PHP script, which calls mautic and then mautic calls the script itself. I finally figured out how to make mautic write something else than “Callback is not valid.” Now I am facing bigger issue. When the script is called again when returning from mautic, all I can see is this:

When returned back, I have two new GET parametres. Example:

oauth_token = 5maxsedwvz8k08oc4s4sggscggk04c808owg4kocg4c48kwc8s
oauth_verifier = 2gdxm0o4ylgkgkgwssws48o80w8wsw0ckokgk0gg4gw44o88g8

I looked into HTTP headers in mozilla web developers tools and found nothing.

So, I give up and ask here: How should I map the above two GET parameters to the four what the API documentation says?

bump

You didn’t specify what version of OAuth are you using. If you look a little deeper to the code example you are quoting:

    // $accessTokenData will have the following keys:
    // For OAuth1.0a: access_token, access_token_secret, expires
    // For OAuth2: access_token, expires, token_type, refresh_token

To answer your question, oauth_token is accessToken and oauth_verifier is accessTokenSecret for OAuth1.0a. Is that clear now?

BTW, check also https://developer.mautic.org/#rest-api