Method: ContactAuthHelper#mints_contact_login
- Defined in:
- lib/mints/helpers/contact_auth_helper.rb
#mints_contact_login(email, password) ⇒ Object
Mints Contact Login.
Starts a contact session in mints.cloud and set a session cookie
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/mints/helpers/contact_auth_helper.rb', line 5 def mints_contact_login(email, password) # 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 |