File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " simple-oauth2-github" ,
3- "version" : " 0.5.0 " ,
3+ "version" : " 0.5.1 " ,
44 "description" : " A simple Node.js client library for GitHub OAuth2." ,
55 "keywords" : [
66 " oauth2" ,
Original file line number Diff line number Diff line change @@ -95,8 +95,15 @@ module.exports = {
9595 // Middleware to request access_token.
9696 const accessToken = ( req , res , next ) => {
9797 const code = req . query . code ;
98+
9899 if ( ! code ) {
99- return next ( new Error ( 'SimpleOAuth2Github expects [code] param in the request' ) ) ;
100+ const error = new Error ( 'SimpleOAuth2Github expects [code] param in the request' ) ;
101+
102+ if ( args . returnError ) {
103+ req . tokenError = error ;
104+ }
105+
106+ return next ( args . returnError ? null : error ) ;
100107 }
101108
102109 // Exchange code for access_token.
You can’t perform that action at this time.
0 commit comments