From 59a4ef0994f6c0ccddd4dd1396085462670c8d66 Mon Sep 17 00:00:00 2001 From: Arzumify Date: Fri, 3 May 2024 20:38:08 +0100 Subject: [PATCH] Added the weird padding authlib needs --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index da403b2..117b12e 100644 --- a/main.go +++ b/main.go @@ -35,6 +35,12 @@ var ( const salt_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +func addPadding(encodedString string) string { + paddingCount := 4 - (len(encodedString) % 4) + padding := strings.Repeat("=", paddingCount) + return encodedString + padding +} + func genSalt(length int) string { if length <= 0 { log.Println("[ERROR] Known in genSalt() at", strconv.FormatInt(time.Now().Unix(), 10)+":", "Salt length must be at least one.") @@ -871,7 +877,7 @@ func main() { return } - c.JSON(200, gin.H{"access_token": logincode, "token_type": "bearer", "expires_in": 2592000, "id_token": openid}) + c.JSON(200, gin.H{"access_token": logincode, "token_type": "bearer", "expires_in": 2592000, "id_token": addPadding(openid)}) }) router.POST("/api/deleteauth", func(c *gin.Context) {