8000 expires_in appears to be a string when returned from the token server · Issue #1207 · googleapis/google-auth-library-python · GitHub
[go: up one dir, main page]

Skip to content
expires_in appears to be a string when returned from the token server #1207
Closed
@rfloydb

Description

@rfloydb

When we reach this line of code, we get "TypeError: unsupported type for timedelta seconds component: str"

return _helpers.utcnow() + datetime.timedelta(seconds=expires_in)

It would appear that the response from the token server has expires_in as a string:

Request:

https://securetoken.googleapis.com/v1/token?key=AI... 
{
  'grant_type': 
  'refresh_token', 
  'client_id': '76...', 
  'client_secret': '...', 
  'refresh_token': 'AO...'
}

Response:

{
  'access_token': 'ey...', 
  **'expires_in': '3600'**, 
  'token_type': 'Bearer', 
  'refresh_token': 'AO...', 
  'id_token': 'ey...', 
  'user_id': 'Xs...', 
  'project_id': '23...'
}

Seems this code should expect a string and not an integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0