Skip to content

Instantly share code, notes, and snippets.

@thameera
Created March 23, 2022 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thameera/3412ae452350027d753f587470d0322a to your computer and use it in GitHub Desktop.
Save thameera/3412ae452350027d753f587470d0322a to your computer and use it in GitHub Desktop.
Calling an external API via an Action
exports.onExecutePostLogin = async (event, api) => {
2 const axios = require('axios')
3 const namespace = 'https://example.com'
4
5 try {
6 const res = await axios.get('https://api.kanye.rest/')
7 api.idToken.setCustomClaim(`${namespace}/quote`, res.data.quote)
8 } catch (e) {
9 console.log('Error calling the API')
10 }
11};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment