I'm intested in building some kind of password-less login between a mobile app and an API (assuming I can control both). The motivation is that having to login is very annoying for users and has security risks (eg. users will reuse existing passwords) and I want the users to be able to get started with the app immediately.
I'm wondering if there are some techniques that could work. For instance:
- Generate and random login/password on the mobile device and store the password in the keychain.
- Signup with the API using this login/password combination. This returns a token.
- Token is used in subsequent calls
The drawbacks are:
- Login/passwords can be lost if user deletes app (this could maybe be mitigated by using iCloud to store the login - but that would be bad for the password?)
- Password is stored on the device (however it's in the keychain)
So my questions: is something like this feasible and secure enough? Are there known techniques to do that?
This is very open ended, but generally: don't reinvent the wheel, use a standard solution such as OAuth and/or OpenID Connect (uses OAuth). This has the drawback that users might required to login via a WebView or similar to get a token, but you won't have to store the passwords.
Things to consider:
As for 'secure enough', pretty much everyone uses OAuth nowadays(Twitter, Facebook, etc), so it's at least proven. The actual security will depend on your particular implementation.
Here's what we did:
Basically, the idea is pretty similar to the "forgot password" most services offer:
myapp://login?token=.....
.The good:
The less good :)
I've already implemented this flow into our app, you can read a more in depth explanation here: http://www.drzon.net/passwordless-login-in-mobile-apps/
Some more considerations:
app://
. The way to overcome this is by making the link point to your server instead and redirect there to the actual deep linkhttps://myserver.com/login?token=...
--->myapp://login?token=...
Mozilla wrote about it as well here