You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add additional example with atproto creating records
* Update README.md with links
* add class customization to login component in authproto
* turn status page into component
* modify readme and add screenshots
* fix merge
* remove old example
* remove unneeded deps in auth-only example
* update readme
* fix callouts and edit codeblocks
* add deno note
* clarify example
commented out some parts but reordered some things to flow better in example readme
---------
Co-authored-by: haetae <haetae@32bit.cafe>
Copy file name to clipboardExpand all lines: astro-authproto/README.md
+41-49Lines changed: 41 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
<!-- banner -->
4
4
5
-
ATproto authentication for your Astro site. Free and Easy™!
5
+
ATproto authentication for your [Astro](https://docs.astro.build/en/concepts/why-astro/) site. Free and Easy™!
6
6
7
7
<!-- badges -->
8
8
@@ -31,8 +31,8 @@ In this package, you'll find:
31
31
-`@fujocoded/authproto/components`, which includes:
32
32
- A basic login/logout component to get started quickly
33
33
-`@fujocoded/authproto/helpers`,
34
-
-`getPdsAgent`etc.?
35
-
-`friendsOnly`function (or similar)
34
+
-`getPdsAgent`authorizes a logged in user to post, update, or delete data from ATProto
35
+
-`friendsOnly`finds mutuals from your [Bluesky](https://bsky.app/) account
36
36
37
37
## What can you do with `@fujocoded/authproto`?
38
38
@@ -55,6 +55,7 @@ In this package, you'll find:
55
55
- Make your _own_ ATproto app that shares data with the rest of the network
56
56
57
57
<!-- replace this with a fancier display -->
58
+
<!-- link to atproto explainer -->
58
59
59
60
## Built with Authproto
60
61
@@ -68,53 +69,50 @@ In this package, you'll find:
68
69
- Node
69
70
- NPM/pnpm/yarn
70
71
- Terminal
72
+
-[Server adapter](https://docs.astro.build/en/guides/on-demand-rendering/#server-adapters) to set up sessions
73
+
- (Optional) [session driver](https://docs.astro.build/en/reference/configuration-reference/#sessiondriver) to allow users to log in or log out
71
74
72
75
> [!IMPORTANT]
73
76
> `deno` requires a workaround due to a CJS/ESM import issue within
74
-
> `@atproto/oauth-client-node`.
77
+
> `@atproto/oauth-client-node`. For now, avoid using `deno` and use other package managers.
75
78
76
-
// TODO: we can move this in a details tab
79
+
> [!IMPORTANT]
80
+
> Using either `localStorage` or `sessionStorage` will result in a ["Session storage could not be initialized." error](https://docs.astro.build/en/reference/errors/session-storage-init-error/) (and is considered insecure for handling sessions anyway). Consider other options, like a database.
77
81
78
82
Requires some familiarity with Astro, but if you want to jump in head first:
@@ -137,17 +138,17 @@ import { Login } from "@fujocoded/authproto/components";
137
138
<Login />
138
139
```
139
140
140
-
> [!TIP] You might run into a naming collision issue if you also have a page
141
-
> named `login`. You can fix this by replacing `{ Login }` with `{ Login as
142
-
LoginComponent }`.
141
+
> [!TIP]
142
+
>
143
+
> You might run into a naming collision issue if you also have a page named `login`. You can fix this by replacing `{ Login }` with `{ Login as LoginComponent }`.
143
144
144
145
It'll look like a plain form:
145
146
146
147
<!-- screenshot -->
147
148
148
149
To make a page only visible to logged in users:
149
150
150
-
```ts
151
+
```jsx
151
152
// src/pages/secret.astro
152
153
---
153
154
constloggedInUser=Astro.locals.loggedInUser;
@@ -168,10 +169,7 @@ if (!loggedInUser) {
168
169
169
170
# Okay how do I _actually_ do stuff with this?
170
171
171
-
Check out the example sites included:
172
-
173
-
-[`__example__`](./__example__) shows you how to set up a login flow.
174
-
-`__example_status__` has some examples of creating new records on a PDS.
172
+
Check out the example sites included under the [examples folder](./__examples__/).
175
173
176
174
# Configuration options
177
175
@@ -182,18 +180,12 @@ Check out the example sites included:
182
180
-`defaultDevUser`, optional. The default handle that gets filled out in the
183
181
`<Login />` component during development.
184
182
-`driver`, optional. The driver used to store data about OAuth sessions. This
0 commit comments