# Multi-User Offline Access w/ iOS Lock.swift

**URL:** <https://community.auth0.com/t/multi-user-offline-access-w-ios-lock-swift/9095>\
**Category:** Get Help\
**Tags:** lock-for-ios, ios\
**Created:** [December 30, 2017, 6:15am UTC](https://community.auth0.com/t/multi-user-offline-access-w-ios-lock-swift/9095 "2017-12-30T06:15:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tylerreynolds](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tylerreynolds/32/7546_2.png) [@tylerreynolds](https://community.auth0.com/u/tylerreynolds)\
**Post date:** [December 30, 2017, 6:15am UTC](https://community.auth0.com/t/multi-user-offline-access-w-ios-lock-swift/9095/1 "2017-12-30T06:15:28Z")

</div>

I am developing an app which uses Auth0 for authentication with the following requirements:

1. Users **must** be able to log in with their individual accounts on a _shared_ device.
2. Any time the app enters a background state (the user navigates to the home screen or a different app, for example) the user **must** be logged out automatically.
3. The user **must** enter their username and password any time they wish to log in. The user **must not** be logged in automatically.
4. When the device is not connected to the internet, any user who successfully logged in within the last 7 days **must** be able to log in with their last-used information, after which they **must** reauthenticate before logging in again.

I am having trouble satisfying requirement #4 using Lock.swift v2. I would prefer to avoid forking Lock.swift if possible.

Essentially, no matter what, Lock must display every time the app is opened - I don’t have a problem with that. What I have been unable to find any information on is how to allow a user to enter a username/password while offline, and validate it manually (as Lock.swift doesn’t appear to contain this functionality).

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [January 9, 2018, 7:24pm UTC](https://community.auth0.com/t/multi-user-offline-access-w-ios-lock-swift/9095/2 "2018-01-09T19:24:54Z")

</div>

The combination of multi-user device plus offline authentication is a really complex set of requirements which in general could best be handled by avoiding getting into that situation, but this may be out of your control also. **In terms of Lock the expectation/requirement is that authentication needs to be completed online** so there’s no formal support for validating a username/password offline when using Lock. In addition, I would personally recommend against any approach that requires the storage of password hashes locally on the device.

If the application is offline I’m assuming any triggered actions results in data being stored which can later be synced. In that case if the **data is not sensitive** and the requirement for login was mostly for non-repudiation (action X was done by user Y) then you may want to consider not forcing authentication when oflline and only require authentication when coming online to sync although this would mean each user would need to sync the actions associated with him individually. Depending on the exact circumstances you could even consider having an additional local check that guarantees that it is an _authorized_ user handling the device, but does not require online authentication to be completed; for example, a local pin each user that previously completed authentication can set or some biometric check.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:57am UTC](https://community.auth0.com/t/multi-user-offline-access-w-ios-lock-swift/9095/3 "2018-03-02T05:57:59Z")

</div>


