Method: Mints::BaseController#mints_contact_magic_link_login
- Defined in:
- lib/mints/controllers/base_controller.rb
permalink #mints_contact_magic_link_login(token) ⇒ Object
Mints Contact Magic Link Login.
Starts a contact session in mints.cloud and set a session cookie
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/mints/controllers/base_controller.rb', line 37 def mints_contact_magic_link_login(token) # Login in mints response = @mints_contact.login(email, password) # Get session token from response session_token = response['session_token'] id_token = response['contact']['contact_token'] ? response['contact']['contact_token'] : response['contact']['id_token'] # Set a permanent cookie with the session token .permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true } .permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true } @contact_token = id_token end |