strip '=' signs from encoded api keys (#2472)
Co-authored-by: Thibault "bui" Koechlin <thibault@crowdsec.net>
This commit is contained in:
parent
4c08e1e68c
commit
ac01faf483
1 changed files with 3 additions and 1 deletions
|
@ -33,7 +33,9 @@ func GenerateAPIKey(n int) (string, error) {
|
|||
if _, err := rand.Read(bytes); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString(bytes), nil
|
||||
encoded := base64.StdEncoding.EncodeToString(bytes)
|
||||
// the '=' can cause issues on some bouncers
|
||||
return strings.TrimRight(encoded, "="), nil
|
||||
}
|
||||
|
||||
func NewAPIKey(dbClient *database.Client) *APIKey {
|
||||
|
|
Loading…
Reference in a new issue