feat(channels): align social authorization
This commit is contained in:
@@ -46,9 +46,17 @@ func buildChatwootEmailOAuthAuthorizationURL(accountID uint, cfg chatwootEmailOA
|
||||
}
|
||||
|
||||
func signedChatwootOAuthState(accountID uint, secret string) (string, error) {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
return signedChatwootOAuthStateWithReturnTo(accountID, secret, "")
|
||||
}
|
||||
|
||||
func signedChatwootOAuthStateWithReturnTo(accountID uint, secret string, returnTo string) (string, error) {
|
||||
claims := jwt.MapClaims{
|
||||
"sub": accountID,
|
||||
"iat": time.Now().Unix(),
|
||||
})
|
||||
}
|
||||
if strings.TrimSpace(returnTo) != "" {
|
||||
claims["return_to"] = strings.TrimSpace(returnTo)
|
||||
}
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
return token.SignedString([]byte(secret))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user