Method: Mints::BaseController#mints_contact_magic_link_login

Defined in:
lib/mints/controllers/base_controller.rb

Mints Contact Magic Link Login.

Starts a contact session in mints.cloud and set a session cookie

[View source]

37
38
39
40
41
42
43
44
45
46
47
# File 'lib/mints/controllers/base_controller.rb', line 37

def (token)
    # Login in mints
    response = @mints_contact.(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
    cookies.permanent[:mints_contact_session_token] = { value: session_token, secure: true, httponly: true }
    cookies.permanent[:mints_contact_id] = { value: id_token, secure: true, httponly: true }
    @contact_token = id_token
end