module.exports = function(everyauth) {
  everyauth.github
  .appId(process.env.GITHUB_CLIENT_ID)
  .appSecret(process.env.GITHUB_CLIENT_SECRET)
  .entryPath('/auth/github')
  .callbackPath('/auth/github/callback')
  .scope('repo') // Can be set to a combination of: 'user', 'public_repo', 'repo', 'gist'
  .findOrCreateUser( function (session, accessToken, accessTokenExtra, githubUserMetadata) {
    session.oauth = accessToken;
    return session.uid = githubUserMetadata.login;
  })
  .redirectPath('/');
  everyauth.everymodule.handleLogout( function (req, res) {
    req.logout(); 
    req.session.uid = null;
    res.writeHead(303, { 'Location': this.logoutRedirectPath() });
    res.end();
  });
}

@@ -38,34 +38,17 @@
 %7B%0A  
-everyauth.github%0A  .appId(
+var id = 
 proc
@@ -75,23 +75,25 @@
 T_ID
-)%0A  .appS
+;%0A  var s
 ecret
-(
+ = 
 proc
@@ -120,16 +120,233 @@
 T_SECRET
+;%0A  if (! id) throw new Error(%22Missing environment variable GITHUB_CLIENT_ID%22);%0A  if (! secret) throw new Error(%22Missing environment variable GITHUB_CLIENT_SECRET%22);%0A  everyauth.github%0A  .appId(id)%0A  .appSecret(secret
 )%0A  .ent

throw if auth secrets are missing