import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
pocket: {
type: "app",
app: "pocket",
}
},
async run({steps, $}) {
const pocketReq = {
method: "post",
url: "/v3/add",
data: {
url: "https://pipedream.com",
title: "What a great website!",
access_token: this.pocket.$auth.oauth_access_token,
},
}
// proxy pocket request
return await axios($, {
url: "https://enkogw2a5epb176.m.pipedream.net",
params: {
http_respond: 1,
},
data: pocketReq,
})
},
})
Pocket uses OAuth authentication. When you connect your Pocket account, Pipedream will open a popup window where you can sign into Pocket and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Pocket API.
Pipedream requests the following authorization scopes when you connect your account:
POST
https://getpocket.com/v3/oauth/request
content-type: application/json
X-accept: application/json
consumer_key={{oauth.client_id}}
&
redirect_uri={{oauth.redirect_uri}}
&
state={{oauth.state}}
GET
https://getpocket.com/auth/authorize
?
request_token={{oauth.token}}
&
redirect_uri={{oauth.redirect_uri}}
content-type: application/json
X-accept: application/json
POST
https://getpocket.com/v3/oauth/authorize
content-type: application/json
X-accept: application/json
consumer_key={{oauth.client_id}}
&
code={{oauth.code}}