Node.js 如何使用graphql创建Oauth2

Node.js 如何使用graphql创建Oauth2,node.js,oauth-2.0,graphql,feathersjs,Node.js,Oauth 2.0,Graphql,Feathersjs,我正在使用feathers服务器,我想用facebook或github策略或其他什么实现Oauth2身份验证。但我也希望使用graphql 但是我不知道如何使用graphql实现,我正在使用它作为API,如果我在回调url上发送GET请求,它可以正常工作,我获取令牌,但我希望使用graphql实现,例如在本地或LDAP策略中 const authentication = feathers() authentication.configure(hooks()) .configur

我正在使用feathers服务器,我想用facebook或github策略或其他什么实现Oauth2身份验证。但我也希望使用graphql

但是我不知道如何使用graphql实现,我正在使用它作为API,如果我在回调url上发送GET请求,它可以正常工作,我获取令牌,但我希望使用graphql实现,例如在本地或LDAP策略中

const authentication = feathers()

authentication.configure(hooks())
        .configure(rest(base).superagent(superagent))
        .configure(auth({ storage: localStorage }));


RootMutation: {
    signInLocal(root, {email, password}, context){
        return authentication.authenticate({
            strategy: 'local',
            email: email,
            password: password
        }, context).then(data=>{
            // console.log(data)
            return data
        })
    },
    signInLdap(root, {username, password}, context){
        return authentication.authenticate({
            strategy: 'ldap',
            username: username,
            password: password
        }, context).then(data=>{
            // console.log(data)
            return data
        })
    }
}
我试过了

RootQuery: {        
    signInGithub(root, data, context){
        return authentication.authenticate({
            strategy: 'github',
        }, context).then(data=>{
            console.log(data)
            return data
        })
    }
},
但我犯了个错误

feathers-authentication:passport:authenticate 'github' authentication redirecting to https://github.com/login/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fauth%2Fgithub
%2Fcallback&scope=user&client_id=0b786a43497059d2a28b 302 +3ms

feathers-authentication:middleware:failure-redirect Redirecting to https://github.com/login/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A3000%2Fauth%2Fgithub%2Fcallback&scope=
user&client_id=0b786a43497059d2a28b after failed authentication. +7ms

Error: Unexpected end of JSON input
谢谢你的帮助