Commit 89620a7 1 parent bbfe397 commit 89620a7 Copy full SHA for 89620a7
File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ package oauth2 // import "miniflux.app/v2/internal/oauth2"
6
6
import (
7
7
"crypto/sha256"
8
8
"encoding/base64"
9
- "io"
10
9
11
10
"golang.org/x/oauth2"
12
11
@@ -33,17 +32,14 @@ func (u *Authorization) CodeVerifier() string {
33
32
34
33
func GenerateAuthorization (config * oauth2.Config ) * Authorization {
35
34
codeVerifier := crypto .GenerateRandomStringHex (32 )
36
-
37
- sha2 := sha256 .New ()
38
- io .WriteString (sha2 , codeVerifier )
39
- codeChallenge := base64 .RawURLEncoding .EncodeToString (sha2 .Sum (nil ))
35
+ sum := sha256 .Sum256 ([]byte (codeVerifier ))
40
36
41
37
state := crypto .GenerateRandomStringHex (24 )
42
38
43
39
authUrl := config .AuthCodeURL (
44
40
state ,
45
41
oauth2 .SetAuthURLParam ("code_challenge_method" , "S256" ),
46
- oauth2 .SetAuthURLParam ("code_challenge" , codeChallenge ),
42
+ oauth2 .SetAuthURLParam ("code_challenge" , base64 . RawURLEncoding . EncodeToString ( sum [:]) ),
47
43
)
48
44
49
45
return & Authorization {
You can’t perform that action at this time.
0 commit comments