Skip to content

Commit

Permalink
Merge pull request #480 from Jleagle/master
Browse files Browse the repository at this point in the history
Typos
  • Loading branch information
techknowlogick authored Nov 5, 2022
2 parents f842162 + b41bcac commit d6995e2
Show file tree
Hide file tree
Showing 50 changed files with 89 additions and 89 deletions.
10 changes: 5 additions & 5 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 All @@ -152,7 +152,7 @@ func main() {
)

// OpenID Connect is based on OpenID Connect Auto Discovery URL (https://openid.net/specs/openid-connect-discovery-1_0-17.html)
// because the OpenID Connect provider initialize it self in the New(), it can return an error which should be handled or ignored
// because the OpenID Connect provider initialize itself in the New(), it can return an error which should be handled or ignored
// ignore the error for now
openidConnect, _ := openidConnect.New(os.Getenv("OPENID_CONNECT_KEY"), os.Getenv("OPENID_CONNECT_SECRET"), "http://localhost:3000/auth/openid-connect/callback", os.Getenv("OPENID_CONNECT_DISCOVERY_URL"))
if openidConnect != nil {
Expand Down
6 changes: 3 additions & 3 deletions gothic/gothic.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Package gothic wraps common behaviour when using Goth. This makes it quick, and easy, to get up
and running with Goth. Of course, if you want complete control over how things flow, in regards
and running with Goth. Of course, if you want complete control over how things flow, in regard
to the authentication process, feel free and use Goth directly.
See https://github.com/markbates/goth/blob/master/examples/main.go to see this in action.
Expand Down Expand Up @@ -45,7 +45,7 @@ func init() {
key := []byte(os.Getenv("SESSION_SECRET"))
keySet = len(key) != 0

cookieStore := sessions.NewCookieStore([]byte(key))
cookieStore := sessions.NewCookieStore(key)
cookieStore.Options.HttpOnly = true
Store = cookieStore
defaultStore = Store
Expand Down Expand Up @@ -151,7 +151,7 @@ func GetAuthURL(res http.ResponseWriter, req *http.Request) (string, error) {

/*
CompleteUserAuth does what it says on the tin. It completes the authentication
process and fetches all of the basic information about the user from the provider.
process and fetches all the basic information about the user from the provider.
It expects to be able to get the name of the provider from the query parameters
as either "provider" or ":provider".
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/azureadv2/azureadv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
user.Location = u.OfficeLocation
user.UserID = u.ID
user.AvatarURL = graphAPIResource + fmt.Sprintf("users/%s/photo/$value", u.ID)
// Make sure all of the information returned is available via RawData
// Make sure all the information returned is available via RawData
if err := json.Unmarshal(userBytes, &user.RawData); err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions providers/bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ func (p *Provider) getEmail(user *goth.User, sess *Session) error {
return fmt.Errorf("%s responded with a %d trying to fetch email addresses", p.providerName, response.StatusCode)
}

var mailList = []struct {
var mailList []struct {
Email string `json:"email"`
Primary bool `json:"is_primary"`
Confirmed bool `json:"is_confirmed"`
}{}
}
err = json.NewDecoder(response.Body).Decode(&mailList)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion providers/digitalocean/digitalocean.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (p *Provider) Client() *http.Client {
// Debug is a no-op for the digitalocean package.
func (p *Provider) Debug(debug bool) {}

// BeginAuth asks Github for an authentication end-point.
// BeginAuth asks DigitalOcean for an authentication end-point.
func (p *Provider) BeginAuth(state string) (goth.Session, error) {
url := p.config.AuthCodeURL(state)
session := &Session{
Expand Down
2 changes: 1 addition & 1 deletion providers/discord/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s Session) Marshal() string {
}

// String is equivalent to Marshal. It returns a JSON representation of the
// of the session.
// session.
func (s Session) String() string {
return s.Marshal()
}
Expand Down
2 changes: 1 addition & 1 deletion providers/dropbox/dropbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
user.FirstName = u.Name.GivenName
user.LastName = u.Name.Surname
user.Name = strings.TrimSpace(fmt.Sprintf("%s %s", u.Name.GivenName, u.Name.Surname))
user.Description = u.Name.DisplayName // Full name plus parenthetical team naem
user.Description = u.Name.DisplayName // Full name plus parenthetical team name
user.Email = u.Email
user.NickName = u.Email // Email is the dropbox username
user.Location = u.Country
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
2 changes: 1 addition & 1 deletion providers/fitbit/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (s Session) GetAuthURL() (string, error) {
return s.AuthURL, nil
}

// Authorize completes the the authorization with Fitbit and returns the access
// Authorize completes the authorization with Fitbit and returns the access
// token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
Expand Down
4 changes: 2 additions & 2 deletions providers/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ func getPrivateMail(p *Provider, sess *Session) (email string, err error) {
return email, fmt.Errorf("GitHub API responded with a %d trying to fetch user email", response.StatusCode)
}

var mailList = []struct {
var mailList []struct {
Email string `json:"email"`
Primary bool `json:"primary"`
Verified bool `json:"verified"`
}{}
}
err = json.NewDecoder(response.Body).Decode(&mailList)
if err != nil {
return email, err
Expand Down
6 changes: 3 additions & 3 deletions providers/github/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import (
"github.com/markbates/goth"
)

// Session stores data during the auth process with Github.
// Session stores data during the auth process with GitHub.
type Session struct {
AuthURL string
AccessToken string
}

// GetAuthURL will return the URL set by calling the `BeginAuth` function on the Github provider.
// GetAuthURL will return the URL set by calling the `BeginAuth` function on the GitHub provider.
func (s Session) GetAuthURL() (string, error) {
if s.AuthURL == "" {
return "", errors.New(goth.NoAuthUrlErrorMessage)
}
return s.AuthURL, nil
}

// Authorize the session with Github and return the access token to be stored for future use.
// Authorize the session with GitHub and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(goth.ContextForClient(p.Client()), params.Get("code"))
Expand Down
6 changes: 3 additions & 3 deletions providers/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ func (p *Provider) SetHostedDomain(hd string) {
p.authCodeOptions = append(p.authCodeOptions, oauth2.SetAuthURLParam("hd", hd))
}

// SetLoginHint sets the login_hint parameter for the google OAuth call.
// Use this to prompt the user to login with a specific account.
// SetLoginHint sets the login_hint parameter for the Google OAuth call.
// Use this to prompt the user to log in with a specific account.
// See https://developers.google.com/identity/protocols/oauth2/openid-connect#login-hint
func (p *Provider) SetLoginHint(loginHint string) {
if loginHint == "" {
Expand All @@ -200,7 +200,7 @@ func (p *Provider) SetLoginHint(loginHint string) {
p.authCodeOptions = append(p.authCodeOptions, oauth2.SetAuthURLParam("login_hint", loginHint))
}

// SetAccessType sets the access_type parameter for the google OAuth call.
// SetAccessType sets the access_type parameter for the Google OAuth call.
// If an access token is being requested, the client does not receive a refresh token unless a value of offline is specified.
// See https://developers.google.com/identity/protocols/oauth2/openid-connect#access-type-param
func (p *Provider) SetAccessType(at string) {
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
2 changes: 1 addition & 1 deletion providers/influxcloud/influxcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

const (
// The hard coded domain is difficult here because influx cloud has an acceptance
// domain that is different and we will need that for enterprise development.
// domain that is different, and we will need that for enterprise development.
defaultDomain string = "cloud.influxdata.com"
userAPIPath string = "/api/v1/user"
domainEnvKey string = "INFLUXCLOUD_OAUTH_DOMAIN"
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
6 changes: 3 additions & 3 deletions providers/intercom/intercom.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
)

var (
authURL string = "https://app.intercom.io/oauth"
tokenURL string = "https://api.intercom.io/auth/eagle/token?client_secret=%s"
UserURL string = "https://api.intercom.io/me"
authURL = "https://app.intercom.io/oauth"
tokenURL = "https://api.intercom.io/auth/eagle/token?client_secret=%s"
UserURL = "https://api.intercom.io/me"
)

// New creates the new Intercom provider
Expand Down
6 changes: 3 additions & 3 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 Expand Up @@ -199,7 +199,7 @@ func userFromReader(reader io.Reader, user *goth.User) error {
// only retrieve data where the authorization method allows public (unauthorized) access
if element.AuthorizationMethod == "PUBLIC" {
for _, identifier := range element.Identifiers {
// check to ensure the identifer type is a url linking to the image
// check to ensure the identifier type is a url linking to the image
if identifier.IdentifierType == "EXTERNAL_URL" {
avatarURL = identifier.Identifier
// we only need the first image url
Expand Down
6 changes: 3 additions & 3 deletions providers/linkedin/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
"github.com/markbates/goth"
)

// Session stores data during the auth process with Linkedin.
// Session stores data during the auth process with LinkedIn.
type Session struct {
AuthURL string
AccessToken string
ExpiresAt time.Time
}

// GetAuthURL will return the URL set by calling the `BeginAuth` function on the Linkedin provider.
// GetAuthURL will return the URL set by calling the `BeginAuth` function on the LinkedIn provider.
func (s Session) GetAuthURL() (string, error) {
if s.AuthURL == "" {
return "", errors.New(goth.NoAuthUrlErrorMessage)
}
return s.AuthURL, nil
}

// Authorize the session with Linkedin and return the access token to be stored for future use.
// Authorize the session with LinkedIn and return the access token to be stored for future use.
func (s *Session) Authorize(provider goth.Provider, params goth.Params) (string, error) {
p := provider.(*Provider)
token, err := p.config.Exchange(goth.ContextForClient(p.Client()), params.Get("code"))
Expand Down
2 changes: 1 addition & 1 deletion providers/mailru/mailru.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func New(clientID, clientSecret, redirectURL string, scopes ...string) *Provider
}
}

// Provider is the implementation of `goth.Provider` for accessing Github.
// Provider is the implementation of `goth.Provider` for accessing MAILRU.
type Provider struct {
name string
clientID string
Expand Down
2 changes: 1 addition & 1 deletion providers/microsoftonline/microsoftonline.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
}

// RefreshTokenAvailable refresh token is provided by auth provider or not
// not available for microsoft online as session size hit the limit of max cookie size
// available for microsoft online as session size hit the limit of max cookie size
func (p *Provider) RefreshTokenAvailable() bool {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion providers/nextcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ SESSION_SECRET=1 \
./examples
```

Afterwards, you should be able to login via Nextcloud in the examples app.
Afterwards, you should be able to log in via Nextcloud in the examples app.

## Running the Provider Test

Expand Down
2 changes: 1 addition & 1 deletion providers/onedrive/onedrive.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func userFromReader(r io.Reader, user *goth.User) error {
user.Email = u.Email["account"]
user.Name = u.Name
user.NickName = u.Name
user.UserID = u.Email["account"] //onedrive doesn't provide separate user_id
user.UserID = u.Email["account"] // onedrive doesn't provide separate user_id

return nil
}
Expand Down
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -190,7 +190,7 @@ func (p *Provider) BeginAuth(state string) (goth.Session, error) {
return session, nil
}

// FetchUser will use the the id_token and access requested information about the user.
// FetchUser will use the id_token and access requested information about the user.
func (p *Provider) FetchUser(session goth.Session) (goth.User, error) {
sess := session.(*Session)

Expand Down
2 changes: 1 addition & 1 deletion providers/oura/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type APIError struct {
Description string
}

// NewAPIError initializes an oura APIError
// NewAPIError initializes an Oura APIError
func NewAPIError(code int, description string) APIError {
return APIError{code, description}
}
Expand Down
Loading

0 comments on commit d6995e2

Please sign in to comment.