Skip to content

Commit

Permalink
fix(chalice): fixed Spot token generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tahayk committed Aug 9, 2024
1 parent a29a4bb commit cbead93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions api/chalicelib/core/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,13 @@ def authenticate(email, password, for_change_password=False, include_spot=False)
response = {
**response,
"spotJwt": authorizers.generate_jwt(user_id=r['userId'], tenant_id=r['tenantId'],
iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE),
iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE, for_spot=True),
"spotRefreshToken": authorizers.generate_jwt_refresh(user_id=r['userId'],
tenant_id=r['tenantId'],
iat=j_r.spot_jwt_refresh_iat,
aud=spot.AUDIENCE,
jwt_jti=j_r.spot_jwt_refresh_jti),
jwt_jti=j_r.spot_jwt_refresh_jti,
for_spot=True),
"spotRefreshTokenMaxAge": config("JWT_SPOT_REFRESH_EXPIRATION", cast=int)
}
return response
Expand Down
5 changes: 3 additions & 2 deletions ee/api/chalicelib/core/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,13 @@ def authenticate(email, password, for_change_password=False, include_spot=False)
if include_spot:
response = {**response,
"spotJwt": authorizers.generate_jwt(user_id=r['userId'], tenant_id=r['tenantId'],
iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE),
iat=j_r.spot_jwt_iat, aud=spot.AUDIENCE, for_spot=True),
"spotRefreshToken": authorizers.generate_jwt_refresh(user_id=r['userId'],
tenant_id=r['tenantId'],
iat=j_r.spot_jwt_refresh_iat,
aud=spot.AUDIENCE,
jwt_jti=j_r.spot_jwt_refresh_jti),
jwt_jti=j_r.spot_jwt_refresh_jti,
for_spot=True),
"spotRefreshTokenMaxAge": config("JWT_SPOT_REFRESH_EXPIRATION", cast=int),
}
return response
Expand Down

0 comments on commit cbead93

Please sign in to comment.