summaryrefslogtreecommitdiff
path: root/internal/oauth
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-24 15:16:06 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-11-24 15:16:06 +0100
commit5d10e7b2e85b89cb087493279d9c5c9420f0b1e2 (patch)
treef0a63e1bc4f6b46513324f1ad2833102a285889a /internal/oauth
parentf0ec0be5e833f72fc650ce9d093722838e4f8034 (diff)
Util: Get rid of current time helper
Fixes #5
Diffstat (limited to 'internal/oauth')
-rw-r--r--internal/oauth/oauth.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index 4bccdf5..9518d79 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -161,7 +161,7 @@ func (oauth *OAuth) getTokensWithAuthCode(authCode string) error {
"content-type": {"application/x-www-form-urlencoded"},
}
opts := &httpw.HTTPOptionalParams{Headers: headers, Body: data}
- current_time := util.GetCurrentTime()
+ current_time := time.Now()
_, body, bodyErr := httpw.HTTPPostWithOpts(reqURL, opts)
if bodyErr != nil {
return types.NewWrappedError(errorMessage, bodyErr)
@@ -187,7 +187,7 @@ func (oauth *OAuth) getTokensWithAuthCode(authCode string) error {
func (oauth *OAuth) isTokensExpired() bool {
expired_time := oauth.Token.ExpiredTimestamp
- current_time := util.GetCurrentTime()
+ current_time := time.Now()
return !current_time.Before(expired_time)
}
@@ -205,7 +205,7 @@ func (oauth *OAuth) getTokensWithRefresh() error {
"content-type": {"application/x-www-form-urlencoded"},
}
opts := &httpw.HTTPOptionalParams{Headers: headers, Body: data}
- current_time := util.GetCurrentTime()
+ current_time := time.Now()
_, body, bodyErr := httpw.HTTPPostWithOpts(reqURL, opts)
if bodyErr != nil {
return types.NewWrappedError(errorMessage, bodyErr)