Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed square analyzer client error #3887

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/analyzer/analyzers/square/square.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ type SecretInfo struct {
func getPermissions(cfg *config.Config, key string) (PermissionsJSON, error) {
var permissions PermissionsJSON

client := analyzers.NewAnalyzeClient(cfg)
// POST request is considered as non-safe. Square Post request does not change any state.
// We are using unrestricted client to avoid error for non-safe API request.
client := analyzers.NewAnalyzeClientUnrestricted(cfg)
req, err := http.NewRequest("POST", "https://connect.squareup.com/oauth2/token/status", nil)
if err != nil {
return permissions, err
Expand Down Expand Up @@ -183,7 +185,9 @@ func getPermissions(cfg *config.Config, key string) (PermissionsJSON, error) {
func getUsers(cfg *config.Config, key string) (TeamJSON, error) {
var team TeamJSON

client := analyzers.NewAnalyzeClient(cfg)
// POST request is considered as non-safe. Square Post request does not change any state.
// We are using unrestricted client to avoid error for non-safe API request.
client := analyzers.NewAnalyzeClientUnrestricted(cfg)
req, err := http.NewRequest("POST", "https://connect.squareup.com/v2/team-members/search", nil)
if err != nil {
return team, err
Expand Down
Loading