Skip to content
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

feat: add bluesky as a provider #281

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ It can also be set using environment variables:
- Authentik
- AWS Cognito
- Battle.net
- Bluesky (AT Protocol)
- Discord
- Dropbox
- Facebook
Expand Down Expand Up @@ -638,26 +639,26 @@ Checkout the [`SessionConfig`](https://github.com/unjs/h3/blob/c04c458810e34eb15

```bash
# Install dependencies
npm install
pnpm install

# Generate type stubs
npm run dev:prepare
pnpm run dev:prepare

# Develop with the playground
npm run dev
pnpm run dev

# Build the playground
npm run dev:build
pnpm run dev:build

# Run ESLint
npm run lint
pnpm run lint

# Run Vitest
npm run test
npm run test:watch
pnpm run test
pnpm run test:watch

# Release new version
npm run release
pnpm run release
```

<!-- Badges -->
Expand Down
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,22 @@
},
"peerDependencies": {
"@simplewebauthn/browser": "^11.0.0",
"@simplewebauthn/server": "^11.0.0"
"@simplewebauthn/server": "^11.0.0",
"@atproto/oauth-client-node": "^0.2.0",
"@atproto/api": "^0.13.15"
},
"peerDependenciesMeta": {
"@simplewebauthn/browser": {
"optional": true
},
"@simplewebauthn/server": {
"optional": true
},
"@atproto/oauth-client-node": {
"optional": true
},
"@atproto/api": {
"optional": true
}
},
"devDependencies": {
Expand Down
16 changes: 16 additions & 0 deletions playground/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ const providers = computed(() =>
disabled: Boolean(user.value?.github),
icon: 'i-simple-icons-github',
},
{
label: user.value?.bluesky || 'Bluesky',
click() {
const handle = prompt('Enter your Bluesky handle')
if (handle) {
navigateTo({
path: '/auth/bluesky',
query: { handle },
}, {
external: true,
})
}
},
disabled: Boolean(user.value?.bluesky),
icon: 'i-simple-icons-bluesky',
},
{
label: user.value?.gitlab || 'GitLab',
to: '/auth/gitlab',
Expand Down
1 change: 1 addition & 0 deletions playground/auth.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
declare module '#auth-utils' {
interface User {
bluesky?: string
webauthn?: string
email?: string
password?: string
Expand Down
12 changes: 12 additions & 0 deletions playground/server/routes/auth/bluesky.get.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default defineOAuthBlueskyEventHandler({
async onSuccess(event, { user }) {
await setUserSession(event, {
user: {
bluesky: user.did,
},
loggedInAt: Date.now(),
})

return sendRedirect(event, '/')
},
})
Loading
Loading