auth: generate oauth2 state randomly

This commit is contained in:
Philipp Wolfer 2023-11-28 17:58:52 +01:00
parent 4bf0f2c81d
commit b169dd2cc4
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
2 changed files with 35 additions and 1 deletions

View file

@ -50,7 +50,7 @@ var authCmd = &cobra.Command{
// https://www.ietf.org/archive/id/draft-ietf-oauth-security-topics-22.html#name-countermeasures-6
verifier := oauth2.GenerateVerifier()
state := "somestate" // FIXME: Should be a random string
state := auth.RandomState()
// Redirect user to consent page to ask for permission specified scopes.
authUrl := strategy.AuthCodeURL(verifier, state)