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

endpoints: remove duplicated URLs from legacy packages #633

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions amazon/amazon.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package amazon

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Amazon's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.amazon.com/ap/oa",
TokenURL: "https://api.amazon.com/auth/o2/token",
}
var Endpoint = endpoints.Amazon
7 changes: 2 additions & 5 deletions bitbucket/bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package bitbucket

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Bitbucket's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://bitbucket.org/site/oauth2/authorize",
TokenURL: "https://bitbucket.org/site/oauth2/access_token",
}
var Endpoint = endpoints.Bitbucket
7 changes: 2 additions & 5 deletions cern/cern.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package cern // import "golang.org/x/oauth2/cern"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is CERN's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://oauth.web.cern.ch/OAuth/Authorize",
TokenURL: "https://oauth.web.cern.ch/OAuth/Token",
}
var Endpoint = endpoints.Cern
10 changes: 6 additions & 4 deletions endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ var GitLab = oauth2.Endpoint{

// Google is the endpoint for Google.
var Google = oauth2.Endpoint{
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://oauth2.googleapis.com/token",
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://oauth2.googleapis.com/token",
AuthStyle: oauth2.AuthStyleInParams,
}

// Heroku is the endpoint for Heroku.
Expand Down Expand Up @@ -97,8 +98,9 @@ var KaKao = oauth2.Endpoint{

// LinkedIn is the endpoint for LinkedIn.
var LinkedIn = oauth2.Endpoint{
AuthURL: "https://www.linkedin.com/oauth/v2/authorization",
TokenURL: "https://www.linkedin.com/oauth/v2/accessToken",
AuthURL: "https://www.linkedin.com/oauth/v2/authorization",
TokenURL: "https://www.linkedin.com/oauth/v2/accessToken",
AuthStyle: oauth2.AuthStyleInParams,
}

// Mailchimp is the endpoint for Mailchimp.
Expand Down
7 changes: 2 additions & 5 deletions facebook/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package facebook // import "golang.org/x/oauth2/facebook"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Facebook's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.facebook.com/v3.2/dialog/oauth",
TokenURL: "https://graph.facebook.com/v3.2/oauth/access_token",
}
var Endpoint = endpoints.Facebook
7 changes: 2 additions & 5 deletions fitbit/fitbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package fitbit // import "golang.org/x/oauth2/fitbit"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is the Fitbit API's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.fitbit.com/oauth2/authorize",
TokenURL: "https://api.fitbit.com/oauth2/token",
}
var Endpoint = endpoints.Fitbit
7 changes: 2 additions & 5 deletions foursquare/foursquare.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package foursquare // import "golang.org/x/oauth2/foursquare"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Foursquare's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://foursquare.com/oauth2/authorize",
TokenURL: "https://foursquare.com/oauth2/access_token",
}
var Endpoint = endpoints.Foursquare
7 changes: 2 additions & 5 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package github // import "golang.org/x/oauth2/github"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Github's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://github.com/login/oauth/authorize",
TokenURL: "https://github.com/login/oauth/access_token",
}
var Endpoint = endpoints.GitHub
7 changes: 2 additions & 5 deletions gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package gitlab // import "golang.org/x/oauth2/gitlab"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is GitLab's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://gitlab.com/oauth/authorize",
TokenURL: "https://gitlab.com/oauth/token",
}
var Endpoint = endpoints.GitLab
7 changes: 2 additions & 5 deletions google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ import (

"cloud.google.com/go/compute/metadata"
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
"golang.org/x/oauth2/google/internal/externalaccount"
"golang.org/x/oauth2/jwt"
)

// Endpoint is Google's OAuth 2.0 default endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://oauth2.googleapis.com/token",
AuthStyle: oauth2.AuthStyleInParams,
}
var Endpoint = endpoints.Google

// JWTTokenURL is Google's OAuth 2.0 token URL to use with the JWT flow.
const JWTTokenURL = "https://oauth2.googleapis.com/token"
Expand Down
7 changes: 2 additions & 5 deletions heroku/heroku.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package heroku // import "golang.org/x/oauth2/heroku"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Heroku's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://id.heroku.com/oauth/authorize",
TokenURL: "https://id.heroku.com/oauth/token",
}
var Endpoint = endpoints.Heroku
11 changes: 3 additions & 8 deletions hipchat/hipchat.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,16 @@ import (

"golang.org/x/oauth2"
"golang.org/x/oauth2/clientcredentials"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is HipChat's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.hipchat.com/users/authorize",
TokenURL: "https://api.hipchat.com/v2/oauth/token",
}
var Endpoint = endpoints.HipChat

// ServerEndpoint returns a new oauth2.Endpoint for a HipChat Server instance
// running on the given domain or host.
func ServerEndpoint(host string) oauth2.Endpoint {
return oauth2.Endpoint{
AuthURL: "https://" + host + "/users/authorize",
TokenURL: "https://" + host + "/v2/oauth/token",
}
return endpoints.HipChatServer(host)
}

// ClientCredentialsConfigFromCaps generates a Config from a HipChat API
Expand Down
7 changes: 2 additions & 5 deletions instagram/instagram.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package instagram // import "golang.org/x/oauth2/instagram"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Instagram's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://api.instagram.com/oauth/authorize",
TokenURL: "https://api.instagram.com/oauth/access_token",
}
var Endpoint = endpoints.Instagram
7 changes: 2 additions & 5 deletions kakao/kakao.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package kakao // import "golang.org/x/oauth2/kakao"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Kakao's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://kauth.kakao.com/oauth/authorize",
TokenURL: "https://kauth.kakao.com/oauth/token",
}
var Endpoint = endpoints.KaKao
8 changes: 2 additions & 6 deletions linkedin/linkedin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
package linkedin // import "golang.org/x/oauth2/linkedin"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is LinkedIn's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.linkedin.com/oauth/v2/authorization",
TokenURL: "https://www.linkedin.com/oauth/v2/accessToken",
AuthStyle: oauth2.AuthStyleInParams,
}
var Endpoint = endpoints.LinkedIn
7 changes: 2 additions & 5 deletions mailchimp/mailchimp.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
package mailchimp // import "golang.org/x/oauth2/mailchimp"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is MailChimp's OAuth 2.0 endpoint.
// See http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/
var Endpoint = oauth2.Endpoint{
AuthURL: "https://login.mailchimp.com/oauth2/authorize",
TokenURL: "https://login.mailchimp.com/oauth2/token",
}
var Endpoint = endpoints.Mailchimp
7 changes: 2 additions & 5 deletions mailru/mailru.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package mailru // import "golang.org/x/oauth2/mailru"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Mail.Ru's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://o2.mail.ru/login",
TokenURL: "https://o2.mail.ru/token",
}
var Endpoint = endpoints.Mailru
12 changes: 3 additions & 9 deletions mediamath/mediamath.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
package mediamath // import "golang.org/x/oauth2/mediamath"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is MediaMath's OAuth 2.0 endpoint for production.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://api.mediamath.com/oauth2/v1.0/authorize",
TokenURL: "https://api.mediamath.com/oauth2/v1.0/token",
}
var Endpoint = endpoints.MediaMath

// SandboxEndpoint is MediaMath's OAuth 2.0 endpoint for sandbox.
var SandboxEndpoint = oauth2.Endpoint{
AuthURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/authorize",
TokenURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/token",
}
var SandboxEndpoint = endpoints.MediaMathSandbox
14 changes: 3 additions & 11 deletions microsoft/microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,17 @@ package microsoft // import "golang.org/x/oauth2/microsoft"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// LiveConnectEndpoint is Windows's Live ID OAuth 2.0 endpoint.
var LiveConnectEndpoint = oauth2.Endpoint{
AuthURL: "https://login.live.com/oauth20_authorize.srf",
TokenURL: "https://login.live.com/oauth20_token.srf",
}
var LiveConnectEndpoint = endpoints.Microsoft

// AzureADEndpoint returns a new oauth2.Endpoint for the given tenant at Azure Active Directory.
// If tenant is empty, it uses the tenant called `common`.
//
// For more information see:
// https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints
func AzureADEndpoint(tenant string) oauth2.Endpoint {
if tenant == "" {
tenant = "common"
}
return oauth2.Endpoint{
AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize",
TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token",
}
return endpoints.AzureAD(tenant)
}
7 changes: 2 additions & 5 deletions nokiahealth/nokiahealth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package nokiahealth

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Nokia Health Mate's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://account.health.nokia.com/oauth2_user/authorize2",
TokenURL: "https://account.health.nokia.com/oauth2/token",
}
var Endpoint = endpoints.NokiaHealth
7 changes: 2 additions & 5 deletions odnoklassniki/odnoklassniki.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package odnoklassniki // import "golang.org/x/oauth2/odnoklassniki"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Odnoklassniki's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.odnoklassniki.ru/oauth/authorize",
TokenURL: "https://api.odnoklassniki.ru/oauth/token.do",
}
var Endpoint = endpoints.Odnoklassniki
12 changes: 3 additions & 9 deletions paypal/paypal.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@
package paypal // import "golang.org/x/oauth2/paypal"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is PayPal's OAuth 2.0 endpoint in live (production) environment.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize",
TokenURL: "https://api.paypal.com/v1/identity/openidconnect/tokenservice",
}
var Endpoint = endpoints.PayPal

// SandboxEndpoint is PayPal's OAuth 2.0 endpoint in sandbox (testing) environment.
var SandboxEndpoint = oauth2.Endpoint{
AuthURL: "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize",
TokenURL: "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice",
}
var SandboxEndpoint = endpoints.PayPalSandbox
7 changes: 2 additions & 5 deletions slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package slack // import "golang.org/x/oauth2/slack"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Slack's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://slack.com/oauth/authorize",
TokenURL: "https://slack.com/api/oauth.access",
}
var Endpoint = endpoints.Slack
7 changes: 2 additions & 5 deletions spotify/spotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
package spotify // import "golang.org/x/oauth2/spotify"

import (
"golang.org/x/oauth2"
"golang.org/x/oauth2/endpoints"
)

// Endpoint is Spotify's OAuth 2.0 endpoint.
var Endpoint = oauth2.Endpoint{
AuthURL: "https://accounts.spotify.com/authorize",
TokenURL: "https://accounts.spotify.com/api/token",
}
var Endpoint = endpoints.Spotify