Get an access token from Keycloak via password grant.
(
username: str,
password: str,
*,
client_id: str = "openshell-cli",
scopes: str | None = None,
)
| 94 | |
| 95 | |
| 96 | def _get_token( |
| 97 | username: str, |
| 98 | password: str, |
| 99 | *, |
| 100 | client_id: str = "openshell-cli", |
| 101 | scopes: str | None = None, |
| 102 | ) -> str: |
| 103 | """Get an access token from Keycloak via password grant.""" |
| 104 | data = { |
| 105 | "grant_type": "password", |
| 106 | "client_id": client_id, |
| 107 | "username": username, |
| 108 | "password": password, |
| 109 | } |
| 110 | if scopes: |
| 111 | data["scope"] = scopes |
| 112 | return _token_request(data) |
| 113 | |
| 114 | |
| 115 | def _get_ci_token( |
no test coverage detected