Skip to content

Instantly share code, notes, and snippets.

@graphicbeacon
Last active March 11, 2018 17:20
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 graphicbeacon/f3b3640158445b9b63e450cd1e5be7f8 to your computer and use it in GitHub Desktop.
Save graphicbeacon/f3b3640158445b9b63e450cd1e5be7f8 to your computer and use it in GitHub Desktop.
How to create an application using the Monzo Bank API
const express = require('express');
const request = require('request');
const app = express();
const oauthDetails = {
client_id: '[your client id]',
client_secret: '[your client secret]',
redirect_uri: 'http://localhost:3000/oauth/callback'
};
// Will be populated once received
let accessToken = null;
app.get('/', (req, res) => {
const { client_id, redirect_uri } = oauthDetails;
const monzoAuthUrl = 'https://auth.monzo.com';
res.type('html');
res.send(`
<h1>Hello</h1>
<form action="${monzoAuthUrl}">
<input type="hidden" name="client_id" value="${client_id}" />
<input type="hidden" name="redirect_uri" value="${redirect_uri}" />
<input type="hidden" name="response_type" value="code" />
<button>Sign in</button>
</form>
`);
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment