frasertweedale / hs-jose

Haskell JOSE and JWT library
http://hackage.haskell.org/package/jose
Apache License 2.0
122 stars 46 forks source link

Serialize one "aud" (Audience) Claim to JSON as string #26

Closed beardpotatocat closed 7 years ago

beardpotatocat commented 7 years ago

In https://tools.ietf.org/html/rfc7519#section-4.1.3 - In the special case when the JWT has one audience, the "aud" value MAY be a single case-sensitive string containing a StringOrURI value.

In current implementation is a single value array, for example "aud": ["https://www.googleapis.com/oauth2/v4/token"] but that doesn't work for https://developers.google.com/identity/protocols/OAuth2ServiceAccount where they expect "aud":"https://www.googleapis.com/oauth2/v4/token"

Would it be possible to support singe string in instance ToJSON Audience where toJSON (Audience auds) = toJSON auds ?

frasertweedale commented 7 years ago

Yeah OK... as long as you promise to raise a ticket with Google to fix their implementation as well :)