mirror of https://github.com/status-im/codimd.git
Merge pull request #1058 from ccoenen/bug/oauth2internalerror
InternalOAuthError is not part of passport, but of passport-oauth2 #1056
This commit is contained in:
commit
f1367ba270
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
const Router = require('express').Router
|
const Router = require('express').Router
|
||||||
const passport = require('passport')
|
const passport = require('passport')
|
||||||
const OAuth2Strategy = require('passport-oauth2').Strategy
|
const { Strategy, InternalOAuthError } = require('passport-oauth2')
|
||||||
const config = require('../../../config')
|
const config = require('../../../config')
|
||||||
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
|
const {setReturnToFromReferer, passportGeneralCallback} = require('../utils')
|
||||||
|
|
||||||
let oauth2Auth = module.exports = Router()
|
let oauth2Auth = module.exports = Router()
|
||||||
|
|
||||||
class OAuth2CustomStrategy extends OAuth2Strategy {
|
class OAuth2CustomStrategy extends Strategy {
|
||||||
constructor (options, verify) {
|
constructor (options, verify) {
|
||||||
options.customHeaders = options.customHeaders || {}
|
options.customHeaders = options.customHeaders || {}
|
||||||
super(options, verify)
|
super(options, verify)
|
||||||
|
@ -22,7 +22,7 @@ class OAuth2CustomStrategy extends OAuth2Strategy {
|
||||||
var json
|
var json
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(new passport.InternalOAuthError('Failed to fetch user profile', err))
|
return done(new InternalOAuthError('Failed to fetch user profile', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -67,7 +67,7 @@ OAuth2CustomStrategy.prototype.userProfile = function (accessToken, done) {
|
||||||
var json
|
var json
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(new passport.InternalOAuthError('Failed to fetch user profile', err))
|
return done(new InternalOAuthError('Failed to fetch user profile', err))
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue