Skip to content

Fatal error if data['email'] is missing #6

@kevinrenskers

Description

@kevinrenskers

https://github.com/hwjeremy/siwa-python/blob/main/siwa/library/token/payload.py#L62

The email is not always there, and when it's not, you get a fatal KeyError. In fact, there are more properties that are optional, for example this is the JWT I get for one of my users:

{
  "iss": "https://appleid.apple.com",
  "aud": "[value]",
  "exp": 1634418396,
  "iat": 1634331996,
  "sub": "[value]",
  "c_hash": "[value]",
  "auth_time": 1634331996,
  "nonce_supported": true
}

So both email and email_verified are missing there and will cause KeyError. Probably a lot safer to user .get(key, default_value) for all these data properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions