Open Security2431 opened 11 months ago
Services | Pros | Cons | Conclusion |
---|---|---|---|
next-auth | ✅ Credentials auth ✅ Auth session ✅ oAuth 2.0 ✅ Magic Links ✅ Free solution |
❌ Expo | It's a powerful library, supports prisma DB and have different case solutions. However, expo is not supported. We can use different solution for expo example |
oAuth0 | ✅ Credentials auth ✅ Auth session ✅ oAuth 2.0 ✅ Magic Links ✅ Expo |
❌ 7K users/m free | It's a great solution, unless the price and the controllability |
Firebase | ✅ Credentials sign in ✅ oAuth 2.0 ✅ Magic Links ✅ Expo |
❌ Prisma | Great, unless we've already have MongoDB database |
JWT | ✅ Credentials sign in | ❌ oAuth 2.0 ❌ Magic Links ❌ Expo |
It's just web email/password authentication. May be worked in a pair with other services |
Supertokens | ✅ Credentials auth ✅ oAuth ✅ Magic Links ✅ Free solution ❓ Auth session |
❌ oAuth 2.0 | - Is it really free service?🤔 https://supertokens.com/pricing |
Passport(NodeJS) | ✅ Credentials auth ✅ Auth session ✅ oAuth 2.0 ✅ Magic Links ✅ Free solution |
❌ Expo | Good technology for oAuth, unless its a bit complicated🤔 |
aws-amplify | ✅ Credentials auth ✅ Auth session ✅ oAuth 2.0 ✅ Magic Links |
❌ Weird pricing policy | Haven't look yet, but its aws solution. They always has pitfalls |
apollokit | ✅ Credentials auth ✅ Auth session ✅ oAuth 2.0 ✅ Expo ✅ Free solution |
❌ Magic Links | It's a starter pack. We don't need to use all features from one. However, we can borrow some of approach repo |
Some links: Good to know:
Session cookie | JWT | Combination of session cookies and JWTs | |
---|---|---|---|
Pros | Security | Performance | Balance between performance and security |
Can control all sessions and delete from database on logout | It doesn't involve DB call, so this approach is much faster | Session cookie static value for user auth and jwt token refresh, jwt for server requests | |
Cons | Enval DB on each server request | Can't invoke the token before it expires (that's why set the token from 5 to 30 minutes) | Complexity and self-maintained |
All the data in the JWT token will exist (user role, user id, blocked user, etc.) until the token expires | |||
Length of tokens, sending a large volume of data on every request | |||
Solutions | Replace normal db with redis | Store a list of "revoked tokens" in a database for sign out | I don't know any solutions for it |
SSO
SSO:
Good to know:
TODO: