From 86f519b224791e7abb2fd50dbeeb5d1d19511aa1 Mon Sep 17 00:00:00 2001 From: Gabor Boros Date: Thu, 23 Feb 2023 18:08:41 +0100 Subject: [PATCH] fix: use json tag for token store item Signed-off-by: Gabor Boros --- CHANGELOG.md | 6 ++++++ token_store.go | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df0172a..4b0a2e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [0.1.1] - 2023-02-23 + +**Bug Fixes** + +- Use json tag for token store item ([78ed7cd](https://github.com/gabor-boros/go-oauth2-arangodb/commit/78ed7cd5cc65445a39aa1cef1bfc1ef2ae385e39)) + ## [0.1.0] - 2023-02-23 **Features** diff --git a/token_store.go b/token_store.go index 95745dc..4c30b59 100644 --- a/token_store.go +++ b/token_store.go @@ -46,13 +46,13 @@ func WithTokenStoreDatabase(db arangoDriver.Database) TokenStoreOption { // TokenStoreItem data item type TokenStoreItem struct { - Key string `db:"_key"` - Code string `db:"code"` - Access string `db:"access_token"` - Refresh string `db:"refresh_token"` - Data []byte `db:"data"` - CreatedAt time.Time `db:"created_at"` - ExpiresAt time.Time `db:"expires_at"` + Key string `json:"_key,omitempty"` + Code string `json:"code"` + Access string `json:"access_token"` + Refresh string `json:"refresh_token"` + Data []byte `json:"data"` + CreatedAt time.Time `json:"created_at"` + ExpiresAt time.Time `json:"expires_at"` } // TokenStore is a data struct that stores oauth2 client information. @@ -97,7 +97,7 @@ func (s *TokenStore) removeByQuery(ctx context.Context, query string, bindVars m return cursor.Close() } -// Create creates a new client in the store. +// Create creates a new token in the store. func (s *TokenStore) Create(ctx context.Context, info oauth2.TokenInfo) error { data, err := json.Marshal(info) if err != nil {