Fetch GitHub access token from Pizzly, get GitHub user info
@dylburger
code:
data:privatelast updated:2 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 800,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
get_authentication
auth
to use OAuth tokens and API keys in code via theauths object
(auths.pizzly)
params
Integration Slug

The name (slug) of the integration. For example, github. See the Pizzly docs for more info.

 
github
string ·params.integrationSlug
Auth ID
 
abc-123
string ·params.authId
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params, auths) => {
1
2
3
4
5
6
7
8
9
}
10
import fetch from 'node-fetch';

const { host, secretKey } = auths.pizzly
const authentication = 'Basic ' + Buffer.from(secretKey + ':').toString('base64')

// Retrieve an integration's details
// https://github.com/Bearer/Pizzly/wiki/Reference-:-API#retrieve-an-integrations-details
return await (await fetch(`https://${host}/api/${params.integrationSlug}/authentications/${params.authId}`, { headers: { "Authorization": authentication } })).json()
steps.
get_github_user_info
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
}
10
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({
  auth: steps.get_authentication.$return_value.payload.accessToken,
})

return await octokit.rest.users.getByUsername({
  username: "PipedreamHQ",
});