Skip to content

Conversation

@omnimaxxing
Copy link
Contributor

@omnimaxxing omnimaxxing commented Jan 5, 2025

Add Apple OAuth Support with form_post Response Mode

This PR adds support for Apple OAuth, specifically handling the required form_post response mode when requesting name or email scopes.

Changes

  • Add responseMode option to support different OAuth response modes
  • Update callback endpoint to handle both GET and POST methods
  • Add comprehensive Apple OAuth example
  • Update documentation with Apple OAuth setup guide

Example Usage with Apple OAuth

export const appleOAuth = OAuth2Plugin({
enabled: true,
strategyName: 'apple',
useEmailAsIdentity: true,
serverURL: process.env.NEXT_PUBLIC_URL,
clientId: process.env.APPLE_CLIENT_ID,
clientSecret: process.env.APPLE_CLIENT_SECRET,
authorizePath: '/oauth/apple',
callbackPath: '/oauth/apple/callback',
authCollection: 'users',
tokenEndpoint: 'https://appleid.apple.com/auth/token',
scopes: ['name', 'email'],
providerAuthorizationUrl: 'https://appleid.apple.com/auth/authorize',
responseMode: 'form_post', // Required for Apple when requesting name/email scopes

// ... rest of configuration
})

Testing

  • Tested with both Apple OAuth and existing Google OAuth
  • Verified form_post response handling
  • Confirmed backward compatibility with existing implementations

Documentation

  • Added Apple-specific configuration examples
  • Updated environment variables documentation
  • Added comments explaining the form_post requirement

Breaking Changes

None. All changes are backward compatible.

- Add responseMode parameter to support different OAuth response types
- Update callback endpoint to handle both GET and POST methods
- Maintain backward compatibility with existing OAuth implementations
@omnimaxxing omnimaxxing marked this pull request as draft January 5, 2025 08:15
@omnimaxxing omnimaxxing marked this pull request as ready for review January 5, 2025 10:23
Repository owner deleted a comment from gitguardian bot Jan 8, 2025
@WilsonLe WilsonLe merged commit 97cd124 into WilsonLe:main Jan 8, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants