TFA for OAuth2 Server

Component ID

2573463

Component name

TFA for OAuth2 Server

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

407

Component created

Component changed

Component body

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"}