B: Append last commit
This commit is contained in:
parent
5c7a72cf0f
commit
65167c3e58
|
@ -118,7 +118,6 @@ func ReceiveYoutubeOauth(c *gin.Context) {
|
||||||
log.WithError(err).Errorf("Failed to Unmarshal response from the following url: '%s'", token_url.String())
|
log.WithError(err).Errorf("Failed to Unmarshal response from the following url: '%s'", token_url.String())
|
||||||
c.AbortWithStatus(502)
|
c.AbortWithStatus(502)
|
||||||
}
|
}
|
||||||
log.Infof("oauthResp: %v", *oauthResp)
|
|
||||||
//Set expires at time but shave some time off to refresh token before expire date
|
//Set expires at time but shave some time off to refresh token before expire date
|
||||||
oauthResp.ExpiresAt = time.Now().Add(time.Duration(oauthResp.ExpiresIn)*time.Second - 10)
|
oauthResp.ExpiresAt = time.Now().Add(time.Duration(oauthResp.ExpiresIn)*time.Second - 10)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const VENDOR_ACCOUNT_TYPE = "vendor_account"
|
const VENDOR_ACCOUNT_TYPE = "vendor_account"
|
||||||
|
@ -44,8 +42,3 @@ func (va *VendorAccount) UpdateObjectInfo() {
|
||||||
va.UpdatedAt = now
|
va.UpdatedAt = now
|
||||||
}
|
}
|
||||||
|
|
||||||
func (va *VendorAccount) MakeRequest(req *http.Request, db *mongo.Client) error {
|
|
||||||
if va.OauthCredentials.ExpiresAt.Before(time.Now()) {
|
|
||||||
va.OauthCredentials.RefreshAccessToken(va.Name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue