An example implementation of an AT Protocol (BlueSky) OAuth client using Astro. This example does not use the AT Protocol SDK. It also doesn't use any

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-11-05 12:30:35

An example implementation of an AT Protocol (BlueSky) OAuth client using Astro. This example does not use the AT Protocol SDK. It also doesn't use any Node-specific APIs (except for process.env) and should run in other runtimes (including Cloudflare Workers).

Install dependencies and start the server at port 4321. If you'd like to use a different port, change all occurrences of port 4321 in the codebase.

The AT Protocol requires confidential clients to use signed JWTs for authentication and this example uses JWTs signed with ECDSA with the P-256 curve. Generate a private and public key with openssl:

Remove the header and footer from the .pem files and set the base64 encoded string as OAUTH_PRIVATE_KEY for the private key and as OAUTH_PUBLIC_KEY for the public key.

Also set a OAUTH_KEY_PAIR_ID environment variable. This will be the public ID of your key pair and does not need to be unguessable.

Leave a Comment