MCPcopy Create free account
hub / github.com/aws/aws-cli / _attempt_create_token

Method _attempt_create_token

awscli/botocore/tokens.py:262–283  ·  view source on GitHub ↗
(self, token)

Source from the content-addressed store, hash-verified

260 return self._session.create_client("sso-oidc", config=config)
261
262 def _attempt_create_token(self, token):
263 response = self._client.create_token(
264 grantType=self._GRANT_TYPE,
265 clientId=token["clientId"],
266 clientSecret=token["clientSecret"],
267 refreshToken=token["refreshToken"],
268 )
269 expires_in = timedelta(seconds=response["expiresIn"])
270 new_token = {
271 "startUrl": self._sso_config["sso_start_url"],
272 "region": self._sso_config["sso_region"],
273 "accessToken": response["accessToken"],
274 "expiresAt": self._now() + expires_in,
275 # Cache the registration alongside the token
276 "clientId": token["clientId"],
277 "clientSecret": token["clientSecret"],
278 "registrationExpiresAt": token["registrationExpiresAt"],
279 }
280 if "refreshToken" in response:
281 new_token["refreshToken"] = response["refreshToken"]
282 logger.info("SSO Token refresh succeeded")
283 return new_token
284
285 def _refresh_access_token(self, token):
286 keys = (

Callers 1

_refresh_access_tokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected