Refresh Tokens

This commit is contained in:
2025-03-11 22:39:58 +02:00
parent 5fe09f0a2f
commit 1bad21ae45
13 changed files with 254 additions and 15 deletions

View File

@@ -1,6 +1,8 @@
package auth
import (
"crypto/rand"
"encoding/hex"
"errors"
"fmt"
"github.com/golang-jwt/jwt/v5"
@@ -84,3 +86,13 @@ func GetBearerToken(headers http.Header) (string, error) {
return auth, nil
}
func MakeRefreshToken() (string, error) {
key := make([]byte, 32)
_, err := rand.Read(key)
if err != nil {
return "", err
}
token := hex.EncodeToString(key)
return token, nil
}