SouthAfricaDigitalScience / Project-RASR

The repository to contain the work done during the Sci-GaIA Summer Hackfest to build a web interface to ASR template processing.
Apache License 2.0
0 stars 0 forks source link

simple github authentication - record not unique #23

Open brucellino opened 8 years ago

brucellino commented 8 years ago

I'm working on authentication using Devise, trying out some of the strategies.

Following the tutorial at https://www.digitalocean.com/community/tutorials/how-to-configure-devise-and-omniauth-for-your-rails-application

I added github github authentication, having created an app in my github account.

In the app, we get the following screen which greets us :

![Uploading Screenshot from 2016-07-11 12-09-49.png…]()

The auth bit works (http://localhost:3000/users/auth/github), but the callback is not working. We get the problem :

ActiveRecord::RecordNotUnique in CallbacksController#github

The callbackscontroller is

class CallbacksController < Devise::OmniauthCallbacksController
    def github
        @user = User.from_omniauth(request.env["omniauth.auth"])
        sign_in_and_redirect @user
    end
end
brucellino commented 8 years ago

ok, it seems like the problem is that the user is not being created when login happens :

_csrf_token: "Y/DRWtS7zjGYSVFjIiAoA1tjjrOXiyEn9YL7mK8p/e4="
flash: {"discard"=>[], "flashes"=>{"alert"=>"You need to sign in or sign up before continuing."}}
session_id: "8bad276d2472f7fbb82906283004bce6"
user_return_to: "/"
warden.user.user.key: [nil, "$2a$11$wS/FLrPTI.hKbP26rH2M0O"]

This seems obvious now - we need to have a sign up section, or authorise everyone automatically.