FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
tionis
tionislastlogin
Remix of stevekrouse/lastlogin
Public
Like
lastlogin
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Lastlogin Authentication for val.town

Screenshot 2024-08-08 at 08.48.41.gif

Live demo: https://stevekrouse-lastlogin_demo.web.val.run/ Source: @stevekrouse/lastlogin_demo

Usage

Wrap your http handlers in a lastlogin middleware (sessions will be persisted in the lastlogin_session table on your sqlite account).

Create val
/** @jsxImportSource npm:hono@3/jsx */ import { lastlogin } from "https://esm.town/v/stevekrouse/lastlogin?v=5"; import { Hono } from "npm:hono"; const app = new Hono(); app.get("/", (c) => { const email = c.req.header("X-LastLogin-Email"); if (email) { return c.html( <div> <h1>Welcome, {email}!</h1> <a href="/auth/logout">Logout</a> </div> ); } else { return c.html( <div> <h1>Welcome to the App</h1> <p>Please sign in to continue.</p> <a href="/auth/login">Sign In</a> </div> ); } }); export default lastlogin(app.fetch);
Code
README.mdmain.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.