import crypto from "crypto";
import { axios } from "@pipedream/platform";
export default defineComponent({
props: {
yourls: {
type: "app",
app: "yourls",
}
},
async run({ steps, $ }) {
const timestamp = Math.floor(Date.now() / 1000)
const signature = crypto
.createHash('md5')
.update(timestamp + this.yourls.$auth.signature_token)
.digest('hex')
return await axios($, {
method: "get",
url: `${this.yourls.$auth.api_url}/yourls-api.php`,
params: {
timestamp,
signature,
action: "shorturl",
url: this.yourls.$auth.test_url,
format: "json"
},
});
},
})
YOURLS uses API keys for authentication. When you connect your YOURLS account, Pipedream securely stores the keys so you can easily authenticate to YOURLS APIs in both code and no-code steps.