Last active
March 11, 2018 17:28
-
-
Save graphicbeacon/ee69c811ca8644c1c3c2fd9e439c0c6b to your computer and use it in GitHub Desktop.
How to create an application using the Monzo Bank API
This file contains 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
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