changed context from deprecated no context

This commit is contained in:
0xdcarns
2022-05-27 09:21:14 -04:00
parent 3cda73fe58
commit ed0f992142
3 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package auth package auth
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@@ -90,7 +91,7 @@ func getAzureUserInfo(state string, code string) (*azureOauthUser, error) {
if state != oauth_state_string { if state != oauth_state_string {
return nil, fmt.Errorf("invalid oauth state") return nil, fmt.Errorf("invalid oauth state")
} }
var token, err = auth_provider.Exchange(oauth2.NoContext, code) var token, err = auth_provider.Exchange(context.Background(), code)
if err != nil { if err != nil {
return nil, fmt.Errorf("code exchange failed: %s", err.Error()) return nil, fmt.Errorf("code exchange failed: %s", err.Error())
} }

View File

@@ -1,6 +1,7 @@
package auth package auth
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@@ -90,7 +91,7 @@ func getGithubUserInfo(state string, code string) (*githubOauthUser, error) {
if state != oauth_state_string { if state != oauth_state_string {
return nil, fmt.Errorf("invalid OAuth state") return nil, fmt.Errorf("invalid OAuth state")
} }
var token, err = auth_provider.Exchange(oauth2.NoContext, code) var token, err = auth_provider.Exchange(context.Background(), code)
if err != nil { if err != nil {
return nil, fmt.Errorf("code exchange failed: %s", err.Error()) return nil, fmt.Errorf("code exchange failed: %s", err.Error())
} }

View File

@@ -1,6 +1,7 @@
package auth package auth
import ( import (
"context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
@@ -91,7 +92,7 @@ func getGoogleUserInfo(state string, code string) (*googleOauthUser, error) {
if state != oauth_state_string { if state != oauth_state_string {
return nil, fmt.Errorf("invalid OAuth state") return nil, fmt.Errorf("invalid OAuth state")
} }
var token, err = auth_provider.Exchange(oauth2.NoContext, code) var token, err = auth_provider.Exchange(context.Background(), code)
if err != nil { if err != nil {
return nil, fmt.Errorf("code exchange failed: %s", err.Error()) return nil, fmt.Errorf("code exchange failed: %s", err.Error())
} }