[Fix]: Loaded provider token should always be string (#8332)

This commit is contained in:
Rohit Malhotra
2025-05-07 16:26:31 -04:00
committed by GitHub
parent 77f92ce0aa
commit d82f0f17a9
3 changed files with 8 additions and 5 deletions

View File

@@ -43,7 +43,11 @@ class ProviderToken(BaseModel):
if isinstance(token_value, ProviderToken):
return token_value
elif isinstance(token_value, dict):
token_str = token_value.get('token')
token_str = token_value.get('token', '')
# Override with emtpy string if it was set to None
# Cannot pass None to SecretStr
if token_str is None:
token_str = ''
user_id = token_value.get('user_id')
return cls(token=SecretStr(token_str), user_id=user_id)