Skip to content

Commit

Permalink
Token endpoint auth method fix and logout fix (#131)
Browse files Browse the repository at this point in the history
* Add proper token auth method

* Latest canary

* Remove redirect

* Remove unused import
  • Loading branch information
tom-sherman authored Sep 26, 2024
1 parent 6cd1506 commit e88fc19
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 75 deletions.
2 changes: 0 additions & 2 deletions packages/frontpage/app/(app)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
import { UserAvatar } from "@/lib/components/user-avatar";
import { FRONTPAGE_ATPROTO_HANDLE } from "@/lib/constants";
import { redirect } from "next/navigation";
import { cookies } from "next/headers";
import { revalidatePath } from "next/cache";

Expand Down Expand Up @@ -133,7 +132,6 @@ async function LoginOrLogout() {
await signOut();
deleteAuthCookie(cookies());
revalidatePath("/", "layout");
redirect("/");
}}
>
<DropdownMenuItem asChild>
Expand Down
5 changes: 3 additions & 2 deletions packages/frontpage/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const getClientMetadata = cache(() => {
// TODO: Tweak these?
scope: "atproto transition:generic",
client_name: "Frontpage",
token_endpoint_auth_method: "none",
token_endpoint_auth_method: "private_key_jwt",
token_endpoint_auth_signing_alg: "ES256",
redirect_uris: [`${appUrl}/oauth/callback`] as const,
client_uri: appUrl,
jwks_uri: `${appUrl}/oauth/jwks.json`,
Expand All @@ -82,7 +83,7 @@ export const getClientMetadata = cache(() => {
export const getOauthClientOptions = () =>
({
client_id: getClientMetadata().client_id,
token_endpoint_auth_method: "private_key_jwt",
token_endpoint_auth_method: getClientMetadata().token_endpoint_auth_method,
}) satisfies OauthClient;

export async function getClientPrivateKey() {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontpage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"date-fns": "^3.6.0",
"drizzle-orm": "^0.33.0",
"jose": "^5.4.0",
"next": "15.0.0-canary.167",
"next": "15.0.0-canary.168",
"next-themes": "^0.3.0",
"oauth4webapi": "^2.12.1",
"react": "19.0.0-rc-f994737d14-20240522",
Expand Down
Loading

0 comments on commit e88fc19

Please sign in to comment.