mit-teaching-systems-lab / discourse-edx-lti

Discourse plugin for using Discourse as a discussion forum in EdX courses
http://tsl.mit.edu
MIT License
22 stars 6 forks source link

Create user in auth_provider#after_authenticate #7

Closed kevinrobinson closed 7 years ago

kevinrobinson commented 7 years ago

Addressing issue discussed here: https://meta.discourse.org/t/userauthtoken-error-when-trying-to-create-new-user-in-authprovider/57456/3

Reports of users not being able to sign in, seeing ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR: null value in column "user_id" violates not-null constraint in logs:

/var/www/discourse/app/models/user_auth_token.rb:16:in `generate!'
/var/www/discourse/lib/auth/default_current_user_provider.rb:133:in `log_on_user'
/var/www/discourse/lib/current_user.rb:18:in `log_on_user'
/var/www/discourse/app/controllers/users/omniauth_callbacks_controller.rb:125:in `user_found'
/var/www/discourse/app/controllers/users/omniauth_callbacks_controller.rb:104:in `complete_response_data'
/var/www/discourse/app/controllers/users/omniauth_callbacks_controller.rb:63:in `complete'
kevinrobinson commented 7 years ago

selfie, tested locally