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

Mistake in auth provider callbacks documentation #12534

Closed
hannesharnisch opened this issue Apr 23, 2022 · 0 comments · Fixed by #13450
Closed

Mistake in auth provider callbacks documentation #12534

hannesharnisch opened this issue Apr 23, 2022 · 0 comments · Fixed by #13450
Assignees
Labels
A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@hannesharnisch
Copy link

The example of the password auth provider callbacks does not work because it returns a string instead of a Tuple[string,...]:

async def check_my_login(
        self,
        username: str,
        login_type: str,
        login_dict: "synapse.module_api.JsonDict",
    ) -> Optional[
        Tuple[
            str,
            Optional[Callable[["synapse.module_api.LoginResponse"], Awaitable[None]]],
        ]
    ]:
        if login_type != "my.login_type":
            return None

        if self.credentials.get(username) == login_dict.get("my_field"):
            return self.api.get_qualified_user_id(username)

Link: https://matrix-org.github.io/synapse/develop/modules/password_auth_provider_callbacks.html

If you try to use it it throws an error, that the returned type is not of type Tuple[string,...]

It works if you use:

return (self.api.get_qualified_user_id(username),None)

@H-Shay H-Shay self-assigned this Apr 26, 2022
@H-Shay H-Shay added A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Apr 26, 2022
squahtx pushed a commit that referenced this issue Aug 4, 2022
…13450)

Fixes: #12534

Signed-off-by: Dirk Klimpel <dirk@klimpel.org>
azmeuk pushed a commit to azmeuk/synapse that referenced this issue Aug 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants