How to use the pycognito.exceptions.ForceChangePasswordException function in pycognito

To help you get started, we’ve selected a few pycognito examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NabuCasa / hass-nabucasa / hass_nabucasa / auth.py View on Github external
"""Log user in and fetch certificate."""

        try:
            async with self._request_lock:
                assert not self.cloud.is_logged_in, "Cannot login if already logged in."

                cognito = self._cognito(username=email)
                await self.cloud.run_executor(
                    partial(cognito.authenticate, password=password)
                )
                self.cloud.id_token = cognito.id_token
                self.cloud.access_token = cognito.access_token
                self.cloud.refresh_token = cognito.refresh_token
            await self.cloud.run_executor(self.cloud.write_user_info)

        except ForceChangePasswordException:
            raise PasswordChangeRequired()

        except ClientError as err:
            raise _map_aws_exception(err)

        except EndpointConnectionError:
            raise UnknownError()

pycognito

Python class to integrate Boto3's Cognito client so it is easy to login users. With SRP support.

Apache-2.0
Latest version published 6 months ago

Package Health Score

74 / 100
Full package analysis