Skip to content

Commit

Permalink
fix: comment
Browse files Browse the repository at this point in the history
  • Loading branch information
luoyangze.ptrl committed Feb 5, 2025
1 parent 46badbd commit e666176
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"net/http"
Expand Down Expand Up @@ -169,19 +168,13 @@ type OAuthClientOption func(*oauthOption)
// WithAuthBaseURL adds base URL
func WithAuthBaseURL(baseURL string) OAuthClientOption {
return func(opt *oauthOption) {
if !strings.HasPrefix(baseURL, "http://") && !strings.HasPrefix(baseURL, "https://") {
baseURL = "https://" + baseURL
}
opt.baseURL = baseURL
}
}

// WithAuthWWWURL adds base URL
func WithAuthWWWURL(wwwURL string) OAuthClientOption {
return func(opt *oauthOption) {
if !strings.HasPrefix(wwwURL, "http://") && !strings.HasPrefix(wwwURL, "https://") {
wwwURL = "https://" + wwwURL
}
opt.wwwURL = wwwURL
}
}
Expand Down Expand Up @@ -759,12 +752,7 @@ type OAuthConfig struct {
}

// LoadOAuthAppFromConfig creates an OAuth client based on the provided JSON configuration bytes
func LoadOAuthAppFromConfig(configBytes []byte) (interface{}, error) {
var config OAuthConfig
if err := json.Unmarshal(configBytes, &config); err != nil {
return nil, fmt.Errorf("failed to parse config JSON: %w", err)
}

func LoadOAuthAppFromConfig(config OAuthConfig) (interface{}, error) {
if config.ClientID == "" {
return nil, errors.New("client_id is required")
}
Expand Down

0 comments on commit e666176

Please sign in to comment.