Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

The FranceConnect module offers a plugin for OpenID Connect to let users connect through FranceConnect service.

What is FranceConnect?

FranceConnect is an OpenID Connect based identity provider from the french government that can be used to log in taxes, health services and many more.

A FranceConnect partner account is required to use this module and OpenID Connect version 8.x-1.4 (version 3.0.0 is still in alpha).

Configuration

Enable this module and OpenID Connect and go to /admin/config/services/openid-connect to enable FranceConnect option and fill the information obtained from your partner account (Client ID, Secret key and endpoints).

In the Block layout menu (/admin/structure/block) add the "FranceConnect login" block to the "Content" region (restrict it to /user/login and/user/register).

Finally go to the login page and click the FranceConnect logo where you can choose your provider or a test provider if you're in the "integration" (testing) phase.

Read the module documentation for more detailled instructions.

Alter the data coming from FranceConnect

This module is extending OpenID Connect so refer to its hooks for enhancing the data coming from FranceConnect.

Here are a few relevant examples:

Adding new claim (user data)

/**
 * Implements hook_openid_connect_claims_alter().
 * 
 * Adds claim for FranceConnect mapping.
 * See https://docs.partenaires.franceconnect.gouv.fr/fs/fs-technique/fs-technique-scope-fc/
 *
 * @param $claims
 */
function HOOK_openid_connect_claims_alter(&$claims) {
  $claims['birthcountry'] = [
    'scope' => 'identite_pivot',
    'title' => t('Birth country'),
    'type' => 'string',
    'description' => t('INSEE code for the birth country, see the <a href="@url" target="_blank">list</a>.', ['@url' => 'https://www.insee.fr/fr/information/2560452']),
    ];

Alter incoming user data

When receiving the datas from FranceConnect, you can alter them using

/**
 * Implements hook_openid_connect_post_authorize().
 * Save the birth country only for France.
 *
 * @param \Drupal\user\UserInterface $account
 *   User account object of the authorized user.
 * @param array $context
 *   An associative array with context information:
 *   - tokens:         An array of tokens.
 *   - user_data:      An array of user and session data.
 *   - userinfo:       An array of user information.
 *   - plugin_id:      The plugin identifier.
 *   - sub:            The remote user identifier.
*
* @ingroup openid_connect_api
*/
function HOOK_openid_connect_post_authorize(UserInterface $account, array $context) {
  if (isset($context['userinfo']['birthcountry']) && $context['userinfo']['birthcountry'] == '99100') {
    $account->field_brith_country->value = 'FR';
  }
}

Troubleshooting

The errors returned by FranceConnect are listed in the FranceConnect official documentation.

Here are some common error code:

  • E000009: the redirect_uri difers from the one registered in your partner account.
  • E000019: appears when the Client ID and Secret key aren't correct or don't match the endpoints (ex: mixing integration values with production endpoint).

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
May 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0-alpha1 Pre-release May 20, 2024