Skip to content

Conversation

@zeucapua
Copy link

@zeucapua zeucapua commented Jan 29, 2026

Implements AT Protocol OAuth using @atproto/api and @atproto/oauth-client-node.

WIP: needs better UI for <AuthModal />.

Notes:

  • requires NUXT_SESSION_PASSWORD env variable to encrypt cookies
  • login will fail on preview due to the redirect URIs not matching the generated preview URL

@vercel
Copy link

vercel bot commented Jan 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Jan 29, 2026 4:18am
npmx.dev Ready Ready Preview, Comment Jan 29, 2026 4:18am
1 Skipped Deployment
Project Deployment Review Updated (UTC)
npmx-lunaria Ignored Ignored Preview Jan 29, 2026 4:18am

Request Review

<summary
class="text-fg-subtle cursor-pointer hover:text-fg-muted transition-colors duration-200"
>
What is an Atmosphere account?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we need to figure out a nice way to make account creation very clear, too.

currently if someone doesn't have a bsky account, and has no idea what atproto is, this info doesn't give them much. they need to now dig through the atproto docs and do some googling to find out how to make an account

so we should probably at least mention bsky as an example of how you might have such an account

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good if we want to go ahead use selfhosted.social (it's mine and zeu's and I'm the admin of it) PDS for account creations. You start the OAuth flow to the server with the PDS's url and a create flag. With that the user can sign up for an account on the PDS and be redirected back to npmx authenticated.
This will give users handles ending in .selfhosted.social

I am also good if y'all want me to manage a PDS server with an alternate handle ending for npmx, like npmx.town. atproto oauth doesn't like serving apps if the account logging in shares a domain with the PDS. This is also just more branding if we want them to have that ending in the handle

:aria-label="ariaLabel"
@click="showModal = true"
>
{{ user?.miniDoc?.handle || 'login' }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user itself is a "minidoc", no? so this and the other usages can just be user?.handle?

}
}

export class SessionStore implements NodeSavedSessionStore {
Copy link
Collaborator

@43081j 43081j Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we move this into its own file somewhere? possibly in utils. same for StateStore

event.context.agent = agent

const session = await useSession(event, {
password: process.env.NUXT_SESSION_PASSWORD as string,
Copy link
Collaborator

@43081j 43081j Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is being cast because it is string | undefined - so i think we should actually just throw at the start of this function if NUXT_SESSION_PASSWORD isn't set.

then by this point it'll be guaranteed to be a string.

we should probably do the same in the other handlers too

@43081j
Copy link
Collaborator

43081j commented Jan 29, 2026

just a couple of minor comments but looks good to me, pretty straightforward! nice work 🎉

@@ -0,0 +1,9 @@
export default defineEventHandler(async event => {
const session = await useSession(event, {
password: process.env.NUXT_SESSION_PASSWORD as string,
Copy link
Contributor

@jonathanyeong jonathanyeong Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we create an example .env file that we can commit so people know that they can set NUXT_SESSION_PASSWORD without digging into the code?

There's also runtime config (not sure if that's useful for this case)


const response = await fetch(
`https://slingshot.microcosm.blue/xrpc/com.bad-example.identity.resolveMiniDoc?identifier=${agent.did}`,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to add a user agent here. Helps fig out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants