import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
piwik_pro: {
type: "app",
app: "piwik_pro",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://${this.piwik_pro.$auth.subdomain}.piwik.pro/api/users/v2/me`,
headers: {
Authorization: `Bearer ${this.piwik_pro.$auth.oauth_access_token}`,
},
})
},
})
Piwik PRO uses OAuth authentication. When you connect your Piwik PRO account, Pipedream will open a popup window where you can sign into Piwik PRO and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Piwik PRO API.
Pipedream requests the following authorization scopes when you connect your account:
POSThttps://{{custom_fields.subdomain}}.piwik.pro/auth/tokenaccept: application/jsonclient_id={{custom_fields.client_id}}&client_secret={{custom_fields.client_secret}}&grant_type=client_credentialsPOSThttps://{{custom_fields.subdomain}}.piwik.pro/auth/tokenaccept: application/jsonclient_id={{custom_fields.client_id}}&client_secret={{custom_fields.client_secret}}&grant_type=client_credentials