-
Notifications
You must be signed in to change notification settings - Fork 85
feat: atproto oauth #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: atproto oauth #273
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
| <summary | ||
| class="text-fg-subtle cursor-pointer hover:text-fg-muted transition-colors duration-200" | ||
| > | ||
| What is an Atmosphere account? |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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' }} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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
|
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, | |||
There was a problem hiding this comment.
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}`, | ||
| ) |
There was a problem hiding this comment.
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
Implements AT Protocol OAuth using
@atproto/apiand@atproto/oauth-client-node.WIP: needs better UI for
<AuthModal />.Notes:
NUXT_SESSION_PASSWORDenv variable to encrypt cookies