Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to create an application using the Monzo Bank API
app.get('/oauth/callback', (req, res) => {
const { client_id, client_secret, redirect_uri } = oauthDetails;
const { code } = req.query;
const monzoAuthUrl = `https://api.monzo.com/oauth2/token`;
// Initiate request to retrieve access token
request.post({
url: monzoAuthUrl,
form: {
grant_type: 'authorization_code',
client_id,
client_secret,
redirect_uri,
code
}
}, (err, response, body) => {
accessToken = JSON.parse(body); // Populate accessToken variable with token response
res.redirect('/accounts'); // Send user to their accounts
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.