# HG changeset patch # User Peter Sanchez # Date 1683212901 21600 # Thu May 04 09:08:21 2023 -0600 # Node ID c9bbbbc33f5e1ac45fb5e58c5d80b3c40fb046e2 # Parent 405ac6b28cdd731bc16ac1a04e96e6353d2b45d1 Adding token type diff --git a/bearer.go b/bearer.go --- a/bearer.go +++ b/bearer.go @@ -31,6 +31,7 @@ // BearerToken ... type BearerToken struct { Version uint + Type string Issued Timestamp Expires Timestamp Grants string @@ -39,9 +40,12 @@ } // Encode ... -func (bt *BearerToken) Encode(ctx context.Context) string { +func (b *BearerToken) Encode(ctx context.Context) string { kw := crypto.KWForContext(ctx) - plain, err := bare.Marshal(bt) + if b.Type == "" { + b.Type = "OAUTH2" + } + plain, err := bare.Marshal(b) if err != nil { panic(err) }