Last active
August 2, 2020 12:10
-
-
Save anishsujanani/92900b0ed7c98fd7c1fb7b16287ea3e3 to your computer and use it in GitHub Desktop.
Custom OAuth - auth serv boilerplate
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
| const express = require('express'); | |
| const bodyparser = require('body-parser'); | |
| const path = require('path'); | |
| const crypto = require('crypto'); | |
| const jwt = require('jsonwebtoken'); | |
| const fs = require('fs'); | |
| // for each client, we need to store the origin, client_id, client_secret, client_type | |
| const registered_clients = { | |
| client_1 : { | |
| referer: 'http://13.127.98.56:8443/', | |
| client_type: 'confidential', | |
| client_secret: 'this_is_client_1_secret', | |
| redirect_uri: 'http://13.127.98.56:8443/oauth_callback' | |
| } | |
| } | |
| const code_token_cache = {}; | |
| var app = express(); | |
| app.use(bodyparser.urlencoded({extended: true})); | |
| app.set('view engine', 'ejs'); | |
| app.listen(9000, () => { | |
| console.log('auth server listening on 9000'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment