Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

  • Analyze the repository structure and OAuth implementation
  • Understand the issue: Apple Sign-In requires response_mode=form_post when name or email scopes are requested
  • Identify the solution approach: Use the providerParams mechanism in custom.go to add Apple-specific parameters
  • Add Apple Sign-In configuration to providerParams in app/services/oauth/custom.go
  • Add test cases for Apple Sign-In authorization URL generation
  • Update OAuth callback handler to support form_post response mode (receive POST instead of GET)
  • Add GetFormValue method to Request type
  • Fix WrapRequest to preserve request body for FormValue calls
  • Add ExecutePostForm helper to mock server for testing
  • Add test for POST form_post callback
  • Address code review feedback
  • Run linting and existing tests
  • Code review and security scan
  • Revert unintended changes to .test.env file

Summary

Successfully implemented support for Apple Sign-In's response_mode=form_post requirement. The solution:

✅ Automatically adds response_mode=form_post for Apple providers when name or email is in the scope
✅ Handles both GET and POST OAuth callbacks
✅ Fully tested with new test cases
✅ Backward compatible with existing OAuth providers
✅ No security vulnerabilities detected
✅ All existing tests pass
✅ Reverted unintended .test.env changes

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG] Apple Sign-In: Add support for response_mode=form_post when requesting name or email scopes</issue_title>
<issue_description>## Body:

When configuring “Sign In with Apple” as an OAuth provider, Apple requires that if you request the name or email scopes, the authorize request must include response_mode=form_post. Otherwise, you receive the following error on login:

invalid_request
response_mode must be form_post when name or email scope is requested.

Currently, Fider’s provider configuration does not support adding custom/extra auth parameters, nor does it appear to automatically add this param for Apple. This means Sign In with Apple only works with the minimal openid scope (which provides no user info), and prevents receiving the user’s name/email as described in Apple’s docs.

Feature Request:
Please add support for setting custom authorization parameters—specifically, so Fider can send response_mode=form_post when name or email is requested from Apple.

References:

Impact:
Without this, “Sign in with Apple” in Fider can only provide pseudonymous Apple user IDs, and cannot collect user name/email for app onboarding or integration with existing registration flows.
</issue_description>

Comments on the Issue (you are @copilot in this section)

@mattwoberts @tfraley I might be being thick - but can you provide some docs about this setting from apple - that link doesn't work and I can't find any

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add support for response_mode=form_post in Apple Sign-In Add Apple Sign-In response_mode=form_post support Oct 28, 2025
Copilot AI requested a review from mattwoberts October 28, 2025 14:09
Copilot finished work on behalf of mattwoberts October 28, 2025 14:09
Copy link
Contributor

@mattwoberts mattwoberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you look at the review. In particular can you revert your changes to .test.env

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why so many changes to this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes were unintended - I accidentally replaced the test environment configuration while setting up my local test environment. This has been reverted in commit 6e0210b.

Comment on lines +29 to +34
if hostname == "appleid.apple.com" && config != nil {
scope := strings.ToLower(config.Scope)
if strings.Contains(scope, "name") || strings.Contains(scope, "email") {
v.Add("response_mode", "form_post")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that will be required from other oauth providers in the future, and if so should we make it configurable, or is it unlikey?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach is designed to be extensible. Currently, Apple is the only known provider requiring dynamic parameters based on scope. The implementation handles both:

  1. Static parameters via the providerParams map (like Twitch's claims parameter)
  2. Dynamic parameters based on config (like Apple's response_mode)

If other providers need similar dynamic behavior in the future, the pattern is already established - just add another hostname check with the appropriate logic. Making it fully configurable (e.g., via database or config file) would add complexity without a clear use case yet.

Copy link
Contributor Author

Copilot AI commented Oct 28, 2025

@copilot can you look at the review. In particular can you revert your changes to .test.env

Reverted .test.env changes in commit 6e0210b.

Copilot AI requested a review from mattwoberts October 28, 2025 21:42
Copilot finished work on behalf of mattwoberts October 28, 2025 21:42
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.

[BUG] Apple Sign-In: Add support for response_mode=form_post when requesting name or email scopes

2 participants