enhancement: add access_token_expiry_time env variable

This commit is contained in:
egor.medvedev
2022-03-25 15:21:20 +03:00
parent 1b387f7564
commit 044b025ba2
19 changed files with 163 additions and 13 deletions

View File

@@ -150,7 +150,12 @@ func OAuthCallbackHandler() gin.HandlerFunc {
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
}
expiresIn := int64(1800)
expiresIn := authToken.AccessToken.ExpiresAt - time.Now().Unix()
if expiresIn <= 0 {
expiresIn = 1
}
params := "access_token=" + authToken.AccessToken.Token + "&token_type=bearer&expires_in=" + strconv.FormatInt(expiresIn, 10) + "&state=" + stateValue + "&id_token=" + authToken.IDToken.Token
cookie.SetSession(c, authToken.FingerPrintHash)