Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add users after auth generation #702

Open
dnordgren opened this issue Aug 20, 2015 · 7 comments
Open

Cannot add users after auth generation #702

dnordgren opened this issue Aug 20, 2015 · 7 comments

Comments

@dnordgren
Copy link

I am using geddy version 13.0.8 on Mac OS X 10.10.4. I am attempting to set up user authentication in a new app. However, after auth generation, navigating to /users/add or any of the user routes fails with a 500 server error. I haven't changed the router at all from what geddy generates and I've validated via logging that the user controller's functions are not hit.

You can verify the error for yourself as follows:

dnordgren:Development $ geddy gen app temp
Created app temp.
dnordgren:Development $ cd temp
dnordgren:temp $ geddy gen auth
WARNING: This command will create/overwrite files in your app.
Do you wish to continue?(yes|no)

y
Installing geddy-passport@0.1.x

> bcrypt@0.8.5 install /Users/user/Development/temp/node_modules/geddy-passport/node_modules/bcrypt
> node-gyp rebuild

  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/bcrypt_lib.node
geddy-passport@0.1.8 node_modules/geddy-passport
├── passport-facebook@0.1.6 (pkginfo@0.2.3)
├── passport-yammer@0.1.2 (pkginfo@0.2.3)
├── passport-twitter@0.1.5 (pkginfo@0.2.3)
├── passport@0.1.18 (pause@0.0.1, pkginfo@0.2.3)
├── passport-oauth@0.1.15 (pkginfo@0.2.3, oauth@0.9.13)
├── jake@0.5.18 (minimatch@0.2.14, utilities@0.0.40)
├── nodemailer@0.6.5 (public-address@0.1.1, directmail@0.1.8, he@0.3.6, readable-stream@1.1.13, simplesmtp@0.3.35, mailcomposer@0.2.12)
└── bcrypt@0.8.5 (bindings@1.2.1, nan@2.0.5)

Installing jake@0.5.x passport@0.1.x passport-twitter@0.1.x passport-facebook@0.1.x passport-yammer@0.1.x passport-oauth@0.1.x bcrypt@0.8.x nodemailer@0.6.x 

> bcrypt@0.8.5 install /Users/dereknordgren/Development/temp/node_modules/bcrypt
> node-gyp rebuild

  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
  SOLINK_MODULE(target) Release/bcrypt_lib.node
passport-yammer@0.1.2 node_modules/passport-yammer
└── pkginfo@0.2.3

passport-twitter@0.1.5 node_modules/passport-twitter
└── pkginfo@0.2.3

passport-facebook@0.1.6 node_modules/passport-facebook
└── pkginfo@0.2.3

passport@0.1.18 node_modules/passport
├── pause@0.0.1
└── pkginfo@0.2.3

passport-oauth@0.1.15 node_modules/passport-oauth
├── pkginfo@0.2.3
└── oauth@0.9.13

jake@0.5.18 node_modules/jake
├── utilities@0.0.40
└── minimatch@0.2.14 (lru-cache@2.6.5, sigmund@1.0.1)

nodemailer@0.6.5 node_modules/nodemailer
├── public-address@0.1.1
├── directmail@0.1.8
├── he@0.3.6
├── simplesmtp@0.3.35 (xoauth2@0.1.8, rai@0.1.12)
├── readable-stream@1.1.13 (isarray@0.0.1, inherits@2.0.1, string_decoder@0.10.31, core-util-is@1.0.1)
└── mailcomposer@0.2.12 (mime@1.2.11, dkim-signer@0.1.2, follow-redirects@0.0.3, mimelib@0.2.19)

bcrypt@0.8.5 node_modules/bcrypt
├── bindings@1.2.1
└── nan@2.0.5
Creating file: /Users/user/Development/temp/app/controllers/auth.js
Creating file: /Users/user/Development/temp/app/controllers/main.js
Creating file: /Users/user/Development/temp/app/controllers/passports.js
Creating file: /Users/user/Development/temp/app/controllers/users.js
Creating file: /Users/user/Development/temp/app/models/passport.js
Creating file: /Users/user/Development/temp/app/models/user.js
Creating file: /Users/user/Development/temp/app/views/main/index.html.ejs
Creating file: /Users/user/Development/temp/app/views/main/login.html.ejs
Creating file: /Users/user/Development/temp/app/views/main/logout.html.ejs
Creating file: /Users/user/Development/temp/app/views/users/form.html.ejs
Creating file: /Users/user/Development/temp/app/views/users/add.html.ejs
Creating file: /Users/user/Development/temp/app/views/users/edit.html.ejs
Creating file: /Users/user/Development/temp/app/views/users/index.html.ejs
Creating file: /Users/user/Development/temp/app/views/users/show.html.ejs
Creating file: /Users/user/Development/temp/lib/passport/actions.js
Creating file: /Users/user/Development/temp/lib/passport/index.js
Creating file: /Users/user/Development/temp/lib/passport/strategies.js
Creating file: /Users/user/Development/temp/lib/passport/user.js
Creating file: /Users/user/Development/temp/public/css/auth-buttons.css
Creating file: /Users/user/Development/temp/public/img/auth-icons.png
Creating file: /Users/user/Development/temp/db/migrations/00000000000001_create_users.js
Creating file: /Users/user/Development/temp/db/migrations/00000000000002_create_passports.js

Added authentication routes:
router.get('/login').to('Main.login');
router.get('/logout').to('Main.logout');
router.post('/auth/local').to('Auth.local');
router.get('/auth/twitter').to('Auth.twitter');
router.get('/auth/twitter/callback').to('Auth.twitterCallback');
router.get('/auth/facebook').to('Auth.facebook');
router.get('/auth/facebook/callback').to('Auth.facebookCallback');
router.get('/auth/yammer').to('Auth.yammer');
router.get('/auth/yammer/callback').to('Auth.yammerCallback');
router.get('/auth/google').to('Auth.google');
router.get('/auth/google/callback').to('Auth.googleCallback');
router.resource('users');

Creating secrets.json file with stubbed-out Passport config.
Added app-secret to config/secrets.json.
DO NOT add this file into your revision control.
DO make a backup of it, keep it someplace safe.

Cleaning up...
Please set up your Passport config in config/secrets.json
dnordgren:temp $

Next, I clean up secrets.json by removing twitter, facebook, and yammer from the file since I only desire "native" user authentication.

At this point, I attempt to start the server with $ geddy and the following error occurs:

/Users/user/Development/temp/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:64
  if (!options.authorizationURL) throw new Error('OAuth2Strategy requires a au
                                       ^
Error: OAuth2Strategy requires a authorizationURL option
    at new OAuth2Strategy (/Users/user/Development/temp/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth2.js:64:40)
    at /Users/user/Development/temp/lib/passport/actions.js:40:14
    at Array.forEach (native)
    at Object.<anonymous> (/Users/user/Development/temp/lib/passport/actions.js:15:20)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)

To remedy this error, I remove all entries (leaving an empty array) from SUPPORTED_SERVICES in actions.js since I do not desire any 3rd party authentication.

Next, I re-attempt to start the survey with $ geddy and have success.

However, navigating to /users/add fails (as does /users):

[Thu, 20 Aug 2015 21:05:47 GMT] ERROR ::1 - - [Thu Aug 20 2015 16:05:47 GMT-0500 (CDT)] "GET /users/add 1.1" 500 1661 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36"
Error
    at createConstructor (/usr/local/lib/node_modules/geddy/lib/response/errors.js:68:34)
    at new <anonymous> (/usr/local/lib/node_modules/geddy/lib/response/errors.js:79:33)
    at Object.<anonymous> (/usr/local/lib/node_modules/geddy/lib/response/errors.js:21:10)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/geddy/lib/controller/responder/index.js:6:14)

Any help would be appreciated, thank you.

@ghost
Copy link

ghost commented Mar 11, 2016

Did you have any luck with this error ? I am facing the same issue

@dnordgren
Copy link
Author

@jmiguel77 in app/controllers/users.js around line 10 there is the line:

var EMAIL_ACTIVATION = true;

Try setting that to false. If I recall correctly, that solved my problem.

@gabriel-alecu
Copy link

The (not shown) error seems to be "Error: E-mail activation requires a mailer. Please configure a mailer for your app."

You can view the proper error by installing geddy from the repo instead of npm's database, which contains an old version with error messages broken:

Use npm install -g geddy/geddy instead of just npm install -g geddy.

@mde
Copy link
Contributor

mde commented Mar 30, 2016

👍

@mde
Copy link
Contributor

mde commented Mar 30, 2016

@gabe-alex I've added you as a collaborator. Thanks for chiming in on these issues!

@gabriel-alecu
Copy link

@mde Well, thanks, lol.
I only noticed these because I was trying to use geddy for a project.
But I'll help however I can. :)

@mde
Copy link
Contributor

mde commented Mar 30, 2016

No pressure, sir. :) This lets you fix the stuff that's bothering you, if you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants