PRO: oAuth Example – getToken

This pages shows the oAuth-Token requested from
http://api.json-content-importer.com/extra/api/gettoken.php

The request on this URL must be like this:

  • method: CURL-POST
  • curloptions: Here we define the login user/password to get the token.
CURLOPT_POSTFIELDS={"user":"test", "password":"mypass"}
  • twig-template:
{{ _context.access_token }}

Shortcode (try {{ _context | json_encode }} ): If you get the token remove the “httpstatuscodemustbe200=no” from the shortcode

[jsoncontentimporterpro nameoftemplate="gettoken" httpstatuscodemustbe200=no]

This gives us the token (the token is md5(“mypass”) – in real life this is a not that easy):

a029d0df84eb5549c641e04a9ef389e5

The complete API-response is:

{"access_token":"a029d0df84eb5549c641e04a9ef389e5","token_type":"bearer","expires_in":"3600"} 

In action:

a029d0df84eb5549c641e04a9ef389e5