Commit 4de7bd6
authored
Add Facebook Limited Login Support for iOS (#2046)
## What kind of change does this PR introduce?
This PR adds support for [Facebook Limited
Login](https://developers.facebook.com/docs/facebook-login/limited-login/)
JWT (iOS only) to the `/token?grant_type=id_token` endpoint. This
enables iOS apps using Facebook's Limited Login feature to authenticate
with Supabase without requiring web browser redirects.
## What is the current behavior?
Currently, the `/token?grant_type=id_token` endpoint does not support
Facebook as a provider. When iOS apps using Facebook Limited Login try
to authenticate with their JWT, they receive a `Bad ID token` error
because Facebook's JWT structure is not recognized by the generic OIDC
parser. This is already raised by users in
#1522 as well.
## What is the new behavior?
- iOS apps can now authenticate using Facebook Limited Login JWT via
`signInWithIdToken()` function on the client side
- Facebook JWT are properly parsed and validated
- End users can authenticate on iOS even if they dont allow tracking
([ATT](https://developer.apple.com/documentation/apptrackingtransparency))
## Additional context
Important: Android Platform Limitations
This implementation only supports iOS Facebook Limited Login. Android
developers must continue using the standard OAuth flow
(`signInWithOAuth()`) with web browser redirects.
Why Android is not supported in this PR:
1. Fundamental Token Differences:
- iOS: Facebook Limited Login provides self-contained JWT ID tokens that
follow OIDC standards
- Android: Facebook SDK only provides opaque access tokens (random
strings, not JWTs)
2. Validation Requirements:
- iOS JW: Can be validated using standard OIDC/JWKS (already handled by
our infrastructure)
- Android access tokens: Require calling Facebook Graph API for
validation
3. Architectural Considerations:
- The /token?grant_type=id_token endpoint is designed specifically for
OIDC-compliant JWT
- Adding Graph API validation for Android access tokens would be out of
scope and violate the endpoint's single responsibility
- It would essentially make this an "id_token OR access_token" endpoint,
which breaks the grant type semantics
WIP: Tests in `oidc_test.go` will be added.1 parent 96469bd commit 4de7bd6
2 files changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
124 | 165 | | |
125 | 166 | | |
126 | 167 | | |
| |||
0 commit comments