사용자가 LinkedIn을 사용하여 성공적으로 인증하고 LinkedIn 프로필 데이터를 가져올 수있는 레일 애플리케이션을 실행 중입니다. 내가 가지고있는 (큰) 문제는 로그인 한 사용자와 연결된 쿠키 데이터가 로그 아웃 한 후에도 계속 유지되고 LinkedIn을 통해 인증 된 후에 다른 별도의 사용자가 가져온 것입니다. 첫 번째 사용자의 데이터는 두 번째 사용자의 데이터를 덮어 씁니다 ... 큰 문제입니다.omniauth와 linkedin gem으로 쿠키 지속성
도움을 주시면 대단히 감사하겠습니다! 내가 똑같은 문제가 발생했다
class SessionsController < ApplicationController
def new
end
def create
if env['omniauth.auth']
user = User.from_omniauth(env['omniauth.auth'])
session[:user_id] = user.id
redirect_to auth_path
flash[:success] = 'Signed in with LinkedIn.'
else
user = User.find_by_email(params[:session][:email])
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_back_or user
flash[:success] = 'Signed in the old-fashioned way.'
else
flash.now[:error] = 'Invalid email/password combination'
render 'new'
end
end
end
def destroy
cookies.delete(:remember_token)
session[:user_id] = nil
redirect_to root_path
end
end