Refresh Tokens
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user