This module integrates TFA with OAuth2 Server.

It simply interrupts the Password Credentials ('password') grant type, for users who have enabled TFA.

This module requires version 7.x-1.4 (or later) of OAuth2 Server.

Example request 1:

POST /oauth2/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <base64-encoded client credentials>

grant_type=password&username=foo&password=bar

Example response 1:

HTTP 401 Unauthorized
Content-Type: application/json
X-Drupal-TFA: required, schemes=totp

{"error": "invalid_grant", "error_description": "Two-factor authentication is required."}

Example request 2:

POST /oauth2/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic <base64-encoded client credentials>
X-Drupal-TFA: 123456

grant_type=password&username=foo&password=bar

Example response 2:

HTTP 200 OK
Content-Type: application/json

{"token_type": "bearer", "access_token": "ZXhhbXBsZSBhY2Nlc3MgdG9rZW4"}
Supporting organizations: 

Project information

Releases