import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
traffit: {
type: "app",
app: "traffit",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://${this.traffit.$auth.subdomain}.traffit.com/api/integration/v2/users/`,
headers: {
Authorization: `Bearer ${this.traffit.$auth.oauth_access_token}`,
"x-request-page-size": `5`,
"x-request-current-page": `1`,
},
})
},
})
Traffit uses OAuth authentication. When you connect your Traffit account, Pipedream will open a popup window where you can sign into Traffit and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Traffit API.
Pipedream requests the following authorization scopes when you connect your account:
POST
https://{{custom_fields.subdomain}}.traffit.com/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{custom_fields.client_id}}
&
client_secret={{custom_fields.client_secret}}
&
grant_type=client_credentials
&
scope={{custom_fields.scopes}}
POST
https://{{custom_fields.subdomain}}.traffit.com/oauth2/token
content-type: application/x-www-form-urlencoded
accept: application/json
client_id={{custom_fields.client_id}}
&
client_secret={{custom_fields.client_secret}}
&
grant_type=client_credentials
&
scope={{custom_fields.scopes}}