I’m attempting to build a pack for Linear.app, and as part of that I’d love to be able to use the Linear SDK in my Pack (I’m developing locally) rather than having to translate all the graphql queries to strings.
However, in order to do that, I need to provide the LinearClient with the OAuth2 token that Coda is getting for me using pack.setUserAuthentication
.
Is there a way to access and consume that token once Coda gets it from the user? Ideally, I’d want to do something like:
pack.setUserAuthentication({
type: coda.AuthenticationType.OAuth2,
authorizationUrl: "https://linear.app/oauth/authorize",
tokenUrl: "https://api.linear.app/oauth/token",
scopes: ["read", "write"],
getConnectionName: async function (context) {
let response = await context.fetcher.fetch({
method: "POST",
url: "https://api.linear.app/graphql",
body: JSON.stringify({ "query": `{ query Me { viewer { id name email } }`})
})
return response.body?.data.viewer.name
}
});
// Authenticated Linear Client
const client = new LinearClient({
accessToken: pack.AUTH_TOKEN
})