Skip to content

Commit

Permalink
Merge pull request #136 from rmarscher/lucia-remove-apple-edge-handler
Browse files Browse the repository at this point in the history
Remove apple form_post handler for now
  • Loading branch information
timothymiller authored Jan 4, 2024
2 parents 4803ec7 + 7538881 commit 855dd41
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions apps/next/middleware.ts → apps/next/_middleware.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// This is currently being archived while we rethink how to handle
// Apple OAuth form post data being sent to the app domain.
// This middleware deployed to cloudflare without issue, but the
// getServerSideProps edge function could not deploy to due unrelated
// SSR issues.

import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'

Expand Down
6 changes: 4 additions & 2 deletions apps/next/pages/oauth/[provider].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import Head from 'next/head'

// Apple will POST form data to the redirect URI when scopes have been requested
// @link https://developer.apple.com/documentation/sign_in_with_apple/request_an_authorization_to_the_sign_in_with_apple_server
export { getServerSideProps } from 'app/features/oauth/screen'
export const runtime = 'experimental-edge'
// However, it does deploy to cloudflare due to issues with the SSR function for the react screen
// We are looking into alternatives (possibly using nextjs api routes) to handle Apple's form post
// export { getServerSideProps } from 'app/features/oauth/screen'
// export const runtime = 'experimental-edge'

export default function Page(props: OAuthSignInScreenProps) {
return (
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"hono": "^3.9.2",
"lucia": "3.0.0-beta.12",
"miniflare": "3.20231025.1",
"oslo": "0.26.1",
"oslo": "0.25.0",
"superjson": "1.13.3",
"ts-pattern": "^5.0.5",
"valibot": "^0.20.1"
Expand Down
4 changes: 2 additions & 2 deletions packages/app/features/oauth/screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export const OAuthSignInScreen = ({ appleUser }: OAuthSignInScreenProps): React.
// Maybe there's a superjson plugin or another way to handle it.
appleUser: appleUser
? {
email: appleUser.email || undefined,
}
email: appleUser.email || undefined,
}
: undefined,
})
}, [provider, redirectTo, state, code, sendApiRequestOnLoad, appleUser])
Expand Down

0 comments on commit 855dd41

Please sign in to comment.