mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
changed context from deprecated no context
This commit is contained in:
@@ -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())
|
||||||
}
|
}
|
||||||
|
@@ -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())
|
||||||
}
|
}
|
||||||
|
@@ -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())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user