Skip to content

Commit

Permalink
Format comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Jleagle committed Nov 5, 2022
1 parent f842162 commit 4902a49
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 36 deletions.
8 changes: 4 additions & 4 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ func main() {
eveonline.New(os.Getenv("EVEONLINE_KEY"), os.Getenv("EVEONLINE_SECRET"), "http://localhost:3000/auth/eveonline/callback"),
kakao.New(os.Getenv("KAKAO_KEY"), os.Getenv("KAKAO_SECRET"), "http://localhost:3000/auth/kakao/callback"),

//Pointed localhost.com to http://localhost:3000/auth/yahoo/callback through proxy as yahoo
// Pointed localhost.com to http://localhost:3000/auth/yahoo/callback through proxy as yahoo
// does not allow to put custom ports in redirection uri
yahoo.New(os.Getenv("YAHOO_KEY"), os.Getenv("YAHOO_SECRET"), "http://localhost.com"),
typetalk.New(os.Getenv("TYPETALK_KEY"), os.Getenv("TYPETALK_SECRET"), "http://localhost:3000/auth/typetalk/callback", "my"),
slack.New(os.Getenv("SLACK_KEY"), os.Getenv("SLACK_SECRET"), "http://localhost:3000/auth/slack/callback"),
stripe.New(os.Getenv("STRIPE_KEY"), os.Getenv("STRIPE_SECRET"), "http://localhost:3000/auth/stripe/callback"),
wepay.New(os.Getenv("WEPAY_KEY"), os.Getenv("WEPAY_SECRET"), "http://localhost:3000/auth/wepay/callback", "view_user"),
//By default paypal production auth urls will be used, please set PAYPAL_ENV=sandbox as environment variable for testing
//in sandbox environment
// By default paypal production auth urls will be used, please set PAYPAL_ENV=sandbox as environment variable for testing
// in sandbox environment
paypal.New(os.Getenv("PAYPAL_KEY"), os.Getenv("PAYPAL_SECRET"), "http://localhost:3000/auth/paypal/callback"),
steam.New(os.Getenv("STEAM_KEY"), "http://localhost:3000/auth/steam/callback"),
heroku.New(os.Getenv("HEROKU_KEY"), os.Getenv("HEROKU_SECRET"), "http://localhost:3000/auth/heroku/callback"),
Expand All @@ -133,7 +133,7 @@ func main() {
discord.New(os.Getenv("DISCORD_KEY"), os.Getenv("DISCORD_SECRET"), "http://localhost:3000/auth/discord/callback", discord.ScopeIdentify, discord.ScopeEmail),
meetup.New(os.Getenv("MEETUP_KEY"), os.Getenv("MEETUP_SECRET"), "http://localhost:3000/auth/meetup/callback"),

//Auth0 allocates domain per customer, a domain must be provided for auth0 to work
// Auth0 allocates domain per customer, a domain must be provided for auth0 to work
auth0.New(os.Getenv("AUTH0_KEY"), os.Getenv("AUTH0_SECRET"), "http://localhost:3000/auth/auth0/callback", os.Getenv("AUTH0_DOMAIN")),
xero.New(os.Getenv("XERO_KEY"), os.Getenv("XERO_SECRET"), "http://localhost:3000/auth/xero/callback"),
vk.New(os.Getenv("VK_KEY"), os.Getenv("VK_SECRET"), "http://localhost:3000/auth/vk/callback"),
Expand Down
2 changes: 1 addition & 1 deletion gothic/gothic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func Test_CompleteUserAuthWithSessionDeducedProvider(t *testing.T) {
a := assert.New(t)

res := httptest.NewRecorder()
// Inteintionally omit a provider argument, force looking in session.
// Intentionally omit a provider argument, force looking in session.
req, err := http.NewRequest("GET", "/auth/callback", nil)
a.NoError(err)

Expand Down
4 changes: 2 additions & 2 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type Provider interface {
UnmarshalSession(string) (Session, error)
FetchUser(Session) (User, error)
Debug(bool)
RefreshToken(refreshToken string) (*oauth2.Token, error) //Get new access token based on the refresh token
RefreshTokenAvailable() bool //Refresh token is provided by auth provider or not
RefreshToken(refreshToken string) (*oauth2.Token, error) // Get new access token based on the refresh token
RefreshTokenAvailable() bool // Refresh token is provided by auth provider or not
}

const NoAuthUrlErrorMessage = "an AuthURL has not been set"
Expand Down
2 changes: 1 addition & 1 deletion providers/apple/apple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ nNFzkp23qt9IJDivieB/BBJct1UvhoICg5eZDhSR+x7UH3Uhog8qgoIC
})
a.NoError(err)
a.NotZero(ss)
//fmt.Printf("signed secret: %s", *ss)
// fmt.Printf("signed secret: %s", *ss)
}

func TestAuthorize(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion providers/auth0/auth0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func Test_SessionFromJSON(t *testing.T) {
}

func Test_FetchUser(t *testing.T) {
//t.Parallel()
// t.Parallel()
a := assert.New(t)

httpmock.Activate()
Expand Down
2 changes: 1 addition & 1 deletion providers/azuread/azuread.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
user.LastName = u.LastName
user.NickName = u.Name
user.Location = u.Location
user.UserID = u.UserPrincipalName //AzureAD doesn't provide separate user_id
user.UserID = u.UserPrincipalName // AzureAD doesn't provide separate user_id

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion providers/fitbit/fitbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
return user, fmt.Errorf("%s responded with a %d trying to fetch user information", p.providerName, resp.StatusCode)
}

//err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
// err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
err = userFromReader(resp.Body, &user)
return user, err
}
Expand Down
4 changes: 2 additions & 2 deletions providers/gplus/gplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ func userFromReader(reader io.Reader, user *goth.User) error {
user.LastName = u.LastName
user.NickName = u.Name
user.Email = u.Email
//user.Description = u.Bio
// user.Description = u.Bio
user.AvatarURL = u.Picture
user.UserID = u.ID
//user.Location = u.Location.Name
// user.Location = u.Location.Name

return err
}
Expand Down
4 changes: 2 additions & 2 deletions providers/influxcloud/influxcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func Test_BeginAuth(t *testing.T) {
session, err := provider.BeginAuth("test_state")
s := session.(*Session)
a.NoError(err)
//FIXME: we really need to be able to run this against the acceptance server, too.
// FIXME: we really need to be able to run this against the acceptance server, too.
// How should we do this? Maybe a test envvar switch?
a.Contains(s.AuthURL, "cloud.influxdata.com/oauth/authorize")
a.Contains(s.AuthURL, fmt.Sprintf("client_id=%s", os.Getenv("INFLUXCLOUD_KEY")))
Expand All @@ -76,7 +76,7 @@ func Test_SessionFromJSON(t *testing.T) {

provider := influxcloudProvider()

//FIXME: What is this testing exactly?
// FIXME: What is this testing exactly?
s, err := provider.UnmarshalSession(`{"AuthURL":"http://github.com/auth_url","AccessToken":"1234567890"}`)
a.NoError(err)
session := s.(*Session)
Expand Down
4 changes: 2 additions & 2 deletions providers/linkedin/linkedin.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const (
authURL string = "https://www.linkedin.com/oauth/v2/authorization"
tokenURL string = "https://www.linkedin.com/oauth/v2/accessToken"

//userEndpoint requires scope "r_liteprofile"
// userEndpoint requires scope "r_liteprofile"
userEndpoint string = "//api.linkedin.com/v2/me?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))"
//emailEndpoint requires scope "r_emailaddress"
// emailEndpoint requires scope "r_emailaddress"
emailEndpoint string = "//api.linkedin.com/v2/emailAddress?q=members&projection=(elements*(handle~))"
)

Expand Down
2 changes: 1 addition & 1 deletion providers/openidConnect/openidConnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type RefreshTokenResponse struct {
// The OAuth spec defines the refresh token as an optional response field in the
// refresh token flow. As a result, a new refresh token may not be returned in a successful
// response.
//See more: https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/
// See more: https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/
RefreshToken string `json:"refresh_token,omitempty"`
}

Expand Down
2 changes: 1 addition & 1 deletion providers/oura/oura.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
return user, NewAPIError(resp.StatusCode, fmt.Sprintf("%s responded with a %d trying to fetch user information", p.providerName, resp.StatusCode))
}

//err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
// err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
err = userFromReader(resp.Body, &user)
return user, err
}
Expand Down
4 changes: 2 additions & 2 deletions providers/paypal/paypal.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ const (
sandbox string = "sandbox"
envKey string = "PAYPAL_ENV"

//Endpoints for paypal sandbox env
// Endpoints for paypal sandbox env
authURLSandbox string = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize"
tokenURLSandbox string = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice"
endpointProfileSandbox string = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/userinfo"

//Endpoints for paypal production env
// Endpoints for paypal production env
authURLProduction string = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize"
tokenURLProduction string = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/tokenservice"
endpointProfileProduction string = "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/userinfo"
Expand Down
4 changes: 2 additions & 2 deletions providers/salesforce/salesforce.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var (
AuthURL string = "https://login.salesforce.com/services/oauth2/authorize"
TokenURL string = "https://login.salesforce.com/services/oauth2/token"

//endpointProfile string = "https://api.salesforce.com/2.0/users/me"
// endpointProfile string = "https://api.salesforce.com/2.0/users/me"
)

// Provider is the implementation of `goth.Provider` for accessing Salesforce.
Expand Down Expand Up @@ -95,7 +95,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
return user, err
}

//creating dynamic url to retrieve user information
// creating dynamic url to retrieve user information
userURL := url.Scheme + "://" + url.Host + "/" + url.Path
req, err := http.NewRequest("GET", userURL, nil)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion providers/soundcloud/soundcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
if err != nil {
return err
}
//Soundcloud does not provide the email_id
// Soundcloud does not provide the email_id
user.Name = u.Name
user.NickName = u.NickName
user.UserID = strconv.Itoa(u.ID)
Expand Down
2 changes: 1 addition & 1 deletion providers/spotify/spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
return user, fmt.Errorf("%s responded with a %d trying to fetch user information", p.providerName, resp.StatusCode)
}

//err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
// err = userFromReader(io.TeeReader(resp.Body, os.Stdout), &user)
err = userFromReader(resp.Body, &user)
return user, err
}
Expand Down
2 changes: 1 addition & 1 deletion providers/stripe/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string,
s.AccessToken = token.AccessToken
s.RefreshToken = token.RefreshToken
s.ExpiresAt = token.Expiry
s.ID = token.Extra("stripe_user_id").(string) //Required to get the user info from sales force
s.ID = token.Extra("stripe_user_id").(string) // Required to get the user info from sales force
return token.AccessToken, err
}

Expand Down
2 changes: 1 addition & 1 deletion providers/stripe/stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
if err != nil {
return err
}
user.Email = u.Email //email is not provided by yahoo
user.Email = u.Email // email is not provided by yahoo
user.Name = u.Name
user.NickName = u.Name
user.UserID = u.ID
Expand Down
10 changes: 5 additions & 5 deletions providers/xero/xero.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var (
authorizeURL = "https://api.xero.com/oauth/Authorize"
tokenURL = "https://api.xero.com/oauth/AccessToken"
endpointProfile = "https://api.xero.com/api.xro/2.0/"
//userAgentString should be changed to match the name of your Application
// userAgentString should be changed to match the name of your Application
userAgentString = os.Getenv("XERO_USER_AGENT") + " (goth-xero 1.0)"
privateKeyFilePath = os.Getenv("XERO_PRIVATE_KEY_PATH")
)
Expand All @@ -60,10 +60,10 @@ func New(clientKey, secret, callbackURL string) *Provider {
ClientKey: clientKey,
Secret: secret,
CallbackURL: callbackURL,
//Method determines how you will connect to Xero.
//Options are public, private, and partner
//Use public if this is your first time.
//More details here: https://developer.xero.com/documentation/getting-started/api-application-types
// Method determines how you will connect to Xero.
// Options are public, private, and partner
// Use public if this is your first time.
// More details here: https://developer.xero.com/documentation/getting-started/api-application-types
Method: os.Getenv("XERO_METHOD"),
providerName: "xero",
}
Expand Down
2 changes: 1 addition & 1 deletion providers/yahoo/yahoo.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
if err != nil {
return err
}
user.Email = "" //email is not provided by yahoo
user.Email = "" // email is not provided by yahoo
user.Name = u.Profile.NickName
user.NickName = u.Profile.NickName
user.UserID = u.Profile.ID
Expand Down
6 changes: 3 additions & 3 deletions providers/yammer/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string,
"redirect_uri": CondVal(p.config.RedirectURL),
"scope": CondVal(strings.Join(p.config.Scopes, " ")),
}
//Cant use standard auth2 implementation as yammer returns access_token as json rather than string
//stand methods are throwing exception
//token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
// Cant use standard auth2 implementation as yammer returns access_token as json rather than string
// stand methods are throwing exception
// token, err := p.config.Exchange(goth.ContextForClient(p.Client), params.Get("code"))
autData, err := retrieveAuthData(p, tokenURL, v)
if err != nil {
return "", err
Expand Down

0 comments on commit 4902a49

Please sign in to comment.