fix: update token refresh to use object attributes instead of dict access
This commit is contained in:
parent
1452f2076b
commit
48a3235323
5 changed files with 547 additions and 465 deletions
|
|
@ -15,10 +15,10 @@ type: application
|
||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.2.8
|
version: 0.2.9
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "0.2.8"
|
appVersion: "0.2.9"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ image:
|
||||||
# This sets the pull policy for images.
|
# This sets the pull policy for images.
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# Overrides the image tag whose default is the chart appVersion.
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
tag: "0.2.8"
|
tag: "0.2.9"
|
||||||
|
|
||||||
# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
# This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
|
||||||
imagePullSecrets: []
|
imagePullSecrets: []
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "huesoporro"
|
name = "huesoporro"
|
||||||
version = "0.2.8"
|
version = "0.2.9"
|
||||||
description = "Misc Twitch bots"
|
description = "Misc Twitch bots"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,16 @@ class GetUserByJWTAction(BaseModel):
|
||||||
is_valid = await self.authenticator.token_is_valid(
|
is_valid = await self.authenticator.token_is_valid(
|
||||||
user.external_auth["twitch"]["access_token"]
|
user.external_auth["twitch"]["access_token"]
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info(f"Token {user} is valid: {is_valid}")
|
logger.info(f"Token {user} is valid: {is_valid}")
|
||||||
if not is_valid:
|
if is_valid:
|
||||||
logger.info(f"Refreshing token for user {user}")
|
|
||||||
new_tokens = await self.authenticator.refresh_token(
|
|
||||||
user.external_auth["twitch"]["refresh_token"]
|
|
||||||
)
|
|
||||||
user.external_auth["twitch"]["access_token"] = new_tokens["access_token"] # type: ignore[index]
|
|
||||||
user.external_auth["twitch"]["refresh_token"] = new_tokens["refresh_token"] # type: ignore[index]
|
|
||||||
await self.user_repo.update(user)
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
|
logger.info(f"Refreshing token for user {user}")
|
||||||
|
twitch_auth = await self.authenticator.refresh_token(
|
||||||
|
user.external_auth["twitch"]["refresh_token"]
|
||||||
|
)
|
||||||
|
user.external_auth["twitch"]["access_token"] = twitch_auth.access_token
|
||||||
|
user.external_auth["twitch"]["refresh_token"] = twitch_auth.refresh_token
|
||||||
|
await self.user_repo.update(user)
|
||||||
return user
|
return user
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue