Redirects to the authentication URL for this service. After authentication, the service will redirect back to the given callback URI with additional parameters including ``openid.mode``. We request the given attributes for the authenticated user by default (name, em
(
self,
callback_uri: Optional[str] = None,
ax_attrs: List[str] = ["name", "email", "language", "username"],
)
| 86 | """ |
| 87 | |
| 88 | def authenticate_redirect( |
| 89 | self, |
| 90 | callback_uri: Optional[str] = None, |
| 91 | ax_attrs: List[str] = ["name", "email", "language", "username"], |
| 92 | ) -> None: |
| 93 | """Redirects to the authentication URL for this service. |
| 94 | |
| 95 | After authentication, the service will redirect back to the given |
| 96 | callback URI with additional parameters including ``openid.mode``. |
| 97 | |
| 98 | We request the given attributes for the authenticated user by |
| 99 | default (name, email, language, and username). If you don't need |
| 100 | all those attributes for your app, you can request fewer with |
| 101 | the ax_attrs keyword argument. |
| 102 | |
| 103 | .. versionchanged:: 6.0 |
| 104 | |
| 105 | The ``callback`` argument was removed and this method no |
| 106 | longer returns an awaitable object. It is now an ordinary |
| 107 | synchronous function. |
| 108 | """ |
| 109 | handler = cast(RequestHandler, self) |
| 110 | callback_uri = callback_uri or handler.request.uri |
| 111 | assert callback_uri is not None |
| 112 | args = self._openid_args(callback_uri, ax_attrs=ax_attrs) |
| 113 | endpoint = self._OPENID_ENDPOINT # type: ignore |
| 114 | handler.redirect(endpoint + "?" + urllib.parse.urlencode(args)) |
| 115 | |
| 116 | async def get_authenticated_user( |
| 117 | self, http_client: Optional[httpclient.AsyncHTTPClient] = None |