独自のセッション作成メソッドを作成し、deviseに付属のものを上書きすることができます。まず、ルーターの内側に、あなたは、あなたがあなた自身のコントローラでこれを実装し、工夫を継承することができます
devise_for :users, controllers: {sessions: "sessions"}
を考案カスタマイズします:: SessionsController
class SessionsController < Devise::SessionsController
def new
super
end
def create
self.resource = AuthService.perform(auth_options) # do the custom check here with your service call
sign_in(resource_name, resource) #this will set the devise session and login the user
respond_with resource, :location => after_sign_in_path_for(resource)
end
end
あなた自身のカスタムロジックを持っているに道を譲るべきだとセッションを作成します。また、githubの実装を見て:
https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb
は、それが
おかげで、Leitoに役立ちます願っています。私はあなたが言及した宝石をチェックしています。しかし、それはデータベースを移行するようではありません。 – KavitaC
authentication_tokenという文字列をusersテーブルに追加するだけです。それだけで必要なすべての移行です。例えば、彼らの仕様のアプリでそれをどのように参照してください:https://github.com/baschtl/devise-token_authenticatable/blob/d02b9754db13552b3ad55283330ebf343b788763/spec/support/rails_app/db/migrate/20100401102949_create_tables.rb#L36 – Leito
Leito、私は追加しました2つの新しい列をUserテーブルに追加しましたが、これ以上エラーは発生しません。しかし、https/httpコールは何をするのですか?私は例を見ません。何かのように - > https:// mysite?[email protected]&authentication_token=werewr – KavitaC