From 2e8c79b2113042347e89715ed005585e61f809d5 Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 4 May 2023 09:08:21 -0600 Subject: [PATCH] Adding token type --- bearer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bearer.go b/bearer.go index 5e51d9f..0cafb06 100644 --- a/bearer.go +++ b/bearer.go @@ -31,6 +31,7 @@ func ToTimestamp(t time.Time) Timestamp { // BearerToken ... type BearerToken struct { Version uint + Type string Issued Timestamp Expires Timestamp Grants string @@ -39,9 +40,12 @@ type BearerToken struct { } // 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) } -- 2.45.2