PRO: oAuth2-Demo by using Shortcode in twig-code

This pages shows you how to get access to the data at

This API / URL expects:

  • Useragent: mozilla
  • HTTP-Header with “Authorization:Bearer TOKEN”
  • “TOKEN” has to be obtained from
    For that user / password has to be sent by CURL-POST.

This is called oAuth2, to avoid sending user / password via http, but a TOKEN the API can check if user / password is ok.

We need two JCI-Shortcodes for that.

JCI-Template 1: The Shortcode (orderofshortcodeeval=1 tells the plugin to first execute the twig code and then the Shortcode – 10 would not execute the Shortcode, then you can see the TOKEN…)

[[jsoncontentimporterpro nameoftemplate="demo-oauth" orderofshortcodeeval=1]]

is for the page which will show us the data.

Defined it like this:

  • Name: demo-oauth
  • URL:
  • method: CURL-POST
  • curloptions: CURLOPT_POSTFIELDS={“user”: “test”, “password”: “mypass”}
  • twig-template:
[[jsoncontentimporterpro nameoftemplate="demo-oauth2" curloptions="CURLOPT_USERAGENT=mozilla;CURLOPT_HTTPHEADER=Authorization:Bearer {{access_token | striptags}}"]]

Ok, we need JCI-Template 2:

  • name: demo-oath2
  • URL:
  • method: CURL-GET
  • curloptions: are sent from the other JCI-Template, where this Shortcode is used
  • twig-template:
{% if datasuccess %}
{% for b in boat %}
boat-id: {{}}<br>
{% endfor %}
{% for h in harbour %}
harbour-id: {{}}<br>
{% endfor %}
{% endif %}

In Action:

curlPOST: failed, http-code: 405