Created
March 23, 2022 01:23
-
-
Save thameera/3412ae452350027d753f587470d0322a to your computer and use it in GitHub Desktop.
Calling an external API via an Action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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