use oauth2 password flow for webclient

This commit is contained in:
les
2020-01-27 00:47:03 +01:00
parent 6352cb3d12
commit b706333c85
21 changed files with 367 additions and 448 deletions

View File

@@ -10,6 +10,7 @@ const oauthServer = new OAuthServer({
useErrorHandler: true,
continueMiddleware: false,
debug: true,
requireClientAuthentication: { password: false },
authenticateHandler: {
handle (req) {
if (!req.user) {
@@ -25,9 +26,12 @@ oauth.use(express.json())
oauth.use(express.urlencoded({ extended: false }))
oauth.post('/token', oauthServer.token())
oauth.post('/login', oauthServer.token())
oauth.get('/authorize', oauthServer.authorize())
oauth.use((req, res) => res.sendStatus(404))
oauth.use((err, req, res, next) => {
const error_msg = err.toString()
debug(err)