Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit b0352f9

Browse files
authored
Update documentation for configuring facebook login (#11755)
... and a minor thinko fix in the sample config.
1 parent 6a78ede commit b0352f9

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

changelog.d/11755.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update documentation for configuring login with facebook.

docs/openid.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,6 @@ oidc_providers:
390390

391391
### Facebook
392392

393-
Like Github, Facebook provide a custom OAuth2 API rather than an OIDC-compliant
394-
one so requires a little more configuration.
395-
396393
0. You will need a Facebook developer account. You can register for one
397394
[here](https://developers.facebook.com/async/registration/).
398395
1. On the [apps](https://developers.facebook.com/apps/) page of the developer
@@ -412,24 +409,28 @@ Synapse config:
412409
idp_name: Facebook
413410
idp_brand: "facebook" # optional: styling hint for clients
414411
discover: false
415-
issuer: "https://facebook.com"
412+
issuer: "https://www.facebook.com"
416413
client_id: "your-client-id" # TO BE FILLED
417414
client_secret: "your-client-secret" # TO BE FILLED
418415
scopes: ["openid", "email"]
419-
authorization_endpoint: https://facebook.com/dialog/oauth
420-
token_endpoint: https://graph.facebook.com/v9.0/oauth/access_token
421-
user_profile_method: "userinfo_endpoint"
422-
userinfo_endpoint: "https://graph.facebook.com/v9.0/me?fields=id,name,email,picture"
416+
authorization_endpoint: "https://facebook.com/dialog/oauth"
417+
token_endpoint: "https://graph.facebook.com/v9.0/oauth/access_token"
418+
jwks_uri: "https://www.facebook.com/.well-known/oauth/openid/jwks/"
423419
user_mapping_provider:
424420
config:
425-
subject_claim: "id"
426421
display_name_template: "{{ user.name }}"
422+
email_template: "{{ '{{ user.email }}' }}"
427423
```
428424

429425
Relevant documents:
430-
* https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
431-
* Using Facebook's Graph API: https://developers.facebook.com/docs/graph-api/using-graph-api/
432-
* Reference to the User endpoint: https://developers.facebook.com/docs/graph-api/reference/user
426+
* [Manually Build a Login Flow](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow)
427+
* [Using Facebook's Graph API](https://developers.facebook.com/docs/graph-api/using-graph-api/)
428+
* [Reference to the User endpoint](https://developers.facebook.com/docs/graph-api/reference/user)
429+
430+
Facebook do have an [OIDC discovery endpoint](https://www.facebook.com/.well-known/openid-configuration),
431+
but it has a `response_types_supported` which excludes "code" (which we rely on, and
432+
is even mentioned in their [documentation](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#login)),
433+
so we have to disable discovery and configure the URIs manually.
433434

434435
### Gitea
435436

docs/sample_config.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,10 +1877,13 @@ saml2_config:
18771877
# Defaults to false. Avoid this in production.
18781878
#
18791879
# user_profile_method: Whether to fetch the user profile from the userinfo
1880-
# endpoint. Valid values are: 'auto' or 'userinfo_endpoint'.
1880+
# endpoint, or to rely on the data returned in the id_token from the
1881+
# token_endpoint.
18811882
#
1882-
# Defaults to 'auto', which fetches the userinfo endpoint if 'openid' is
1883-
# included in 'scopes'. Set to 'userinfo_endpoint' to always fetch the
1883+
# Valid values are: 'auto' or 'userinfo_endpoint'.
1884+
#
1885+
# Defaults to 'auto', which uses the userinfo endpoint if 'openid' is
1886+
# not included in 'scopes'. Set to 'userinfo_endpoint' to always use the
18841887
# userinfo endpoint.
18851888
#
18861889
# allow_existing_users: set to 'true' to allow a user logging in via OIDC to

synapse/config/oidc.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,13 @@ def generate_config_section(self, config_dir_path, server_name, **kwargs) -> str
148148
# Defaults to false. Avoid this in production.
149149
#
150150
# user_profile_method: Whether to fetch the user profile from the userinfo
151-
# endpoint. Valid values are: 'auto' or 'userinfo_endpoint'.
151+
# endpoint, or to rely on the data returned in the id_token from the
152+
# token_endpoint.
152153
#
153-
# Defaults to 'auto', which fetches the userinfo endpoint if 'openid' is
154-
# included in 'scopes'. Set to 'userinfo_endpoint' to always fetch the
154+
# Valid values are: 'auto' or 'userinfo_endpoint'.
155+
#
156+
# Defaults to 'auto', which uses the userinfo endpoint if 'openid' is
157+
# not included in 'scopes'. Set to 'userinfo_endpoint' to always use the
155158
# userinfo endpoint.
156159
#
157160
# allow_existing_users: set to 'true' to allow a user logging in via OIDC to

0 commit comments

Comments
 (0)