MCPcopy Create free account
hub / github.com/auth0/auth0-cli / generateState

Function generateState

internal/cli/utils_shared.go:301–309  ·  view source on GitHub ↗

generate state parameter value used to mitigate CSRF attacks more: https://auth0.com/docs/protocols/state-parameters

(size int)

Source from the content-addressed store, hash-verified

299// generate state parameter value used to mitigate CSRF attacks
300// more: https://auth0.com/docs/protocols/state-parameters
301func generateState(size int) (string, error) {
302 b := make([]byte, size)
303 _, err := rand.Read(b)
304 if err != nil {
305 return "", err
306 }
307
308 return base64.RawURLEncoding.EncodeToString(b), nil
309}
310
311// check if slice contains a string.
312func containsStr(s []string, u string) bool {

Callers 3

TestGenerateStateFunction · 0.85
runLoginFlowFunction · 0.85
resolveDetectionSubValueFunction · 0.85

Calls 1

ReadMethod · 0.65

Tested by 1

TestGenerateStateFunction · 0.68