mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00

This allows the API to trigger an OAuth workflow to create the JWT for authentication. For now the workflow is triggered by manually visiting `/api/login/oidc` on the frontend app until the UI repo is updated to add support. Co-authored-by: Peter Olds <peter@olds.co>
13 lines
277 B
Go
13 lines
277 B
Go
package common
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/base64"
|
|
)
|
|
|
|
// GenerateRandomString generates a random string of specified length.
|
|
func GenerateRandomString(length int) string {
|
|
b := make([]byte, length)
|
|
rand.Read(b)
|
|
return base64.URLEncoding.EncodeToString(b)[:length]
|
|
}
|