Important
wip β this is a design doc to guide our initial prototype.
everything should be made as shrimple as possible, but not shrimpler.
Β Β β albert einstein
- keep it shrimple, stupid β we authenticate logins, doing nothing else
- minimalist config β we're obsessed with shrimplicity
- shrimple only works one way β the good one
- π¦ shrimp-tier β β¨
$0/monthβ¨ β infinity free logins via authlocal.org - π¦ crab-tier β
$3/monthβ 10k logins via any provider - π¦ lobster-tier β
$9/monthβ 100k logins via any provider - π whale-tier β
$69/monthβ infinity logins via any provider
- login at https://shrimple.io/ and create your first app
- enter your
allowed origins - flip on the
auth providersyou want to allow - copy your
appId
- install via npm
npm install @e280/shrimple
- import shrimple, serverside or clientside
import shrimple from "@e280/shrimple"
- setup auth
// π¦ paste your appId from shrimple.io const auth = await shrimple("5450372dcb89a55b70b363d66713afdced9faf521bc9daa9284f92b4bb04e668")
- react to login/logout happenings
auth.onChange(user => { if (user) console.log("logged in!", user.name) else console.log("logged out") })
- trigger a login popup (must be on user event!)
auth.loginPopup()
- grab the user token (send to your server in api requests)
auth.user?.token
- logout
await auth.logout()
- crypto-verify the user info
const user = await shrimple.verify(token)
- π¦
user.idβ string
perma id for the user, like"b4f405d674b4c6ab3f0002faee7be09de03b821ce5d3e928fb28a31be54a19ec" - π¦
user.nameβ string
a name/label/nickname, might be"Bubba Gump"or"bubba"or a randomly generated one like"worluc.magbyl" - π¦
user.emailβ string | null
the user's email, likebubba@shrimple.io, but not all auth providers provide this - π¦
user.providerβ "authlocal" | "google" | "apple" | "microsoft"
the name of the service that promised the login is legit - π¦
user.sessionIdβ string
ephemeral id for this one login session, looks like"3642b7a2ff316e43aff061ae021d69884484ed3286248fc10349ddee7902b146" - π¦
user.tokenβ string
json web token for this session, for crypto-verification magic
reward us with github stars
build with us at https://e280.org/ if you're good at dev