You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using matrix-bot-sdk with OAuth2/MAS (Matrix Authentication Service) enabled homeservers, AppService registration fails with M_UNKNOWN_TOKEN: Unrecognised access token.
Root Cause
The ensureRegistered() method in src/appservice/Intent.ts sends a POST request to /_matrix/client/v3/register with:
However, OAuth2/MAS homeservers require inhibit_login: true to be included in the registration request. Without this flag, the homeserver rejects the registration attempt.
Expected Behavior
The SDK should automatically include inhibit_login: true in AppService registration requests to support OAuth2/MAS homeservers.
When using matrix-bot-sdk with OAuth2/MAS (Matrix Authentication Service) enabled homeservers, AppService registration fails with
M_UNKNOWN_TOKEN: Unrecognised access token.Root Cause
The
ensureRegistered()method insrc/appservice/Intent.tssends a POST request to/_matrix/client/v3/registerwith:However, OAuth2/MAS homeservers require
inhibit_login: trueto be included in the registration request. Without this flag, the homeserver rejects the registration attempt.Expected Behavior
The SDK should automatically include
inhibit_login: truein AppService registration requests to support OAuth2/MAS homeservers.Actual Behavior
The registration request fails with:
Workaround
Currently, the only workaround is to manually patch the compiled JavaScript file:
sed -i.bak '/doRequest.*register/,/username:/{s/type: "m.login.application_service",/type: "m.login.application_service",\n inhibit_login: true,/}' node_modules/matrix-bot-sdk/lib/appservice/Intent.jsSuggested Fix
Update the
ensureRegistered()method insrc/appservice/Intent.tsto includeinhibit_login: true:Environment
Additional Context
inhibit_loginflag is required by the Matrix spec for OAuth2 homeservers