golang.org/x/oauth2@v0.18.0/endpoints/endpoints.go (about) 1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package endpoints provides constants for using OAuth2 to access various services. 6 package endpoints 7 8 import ( 9 "strings" 10 11 "golang.org/x/oauth2" 12 ) 13 14 // Amazon is the endpoint for Amazon. 15 var Amazon = oauth2.Endpoint{ 16 AuthURL: "https://www.amazon.com/ap/oa", 17 TokenURL: "https://api.amazon.com/auth/o2/token", 18 } 19 20 // Battlenet is the endpoint for Battlenet. 21 var Battlenet = oauth2.Endpoint{ 22 AuthURL: "https://battle.net/oauth/authorize", 23 TokenURL: "https://battle.net/oauth/token", 24 } 25 26 // Bitbucket is the endpoint for Bitbucket. 27 var Bitbucket = oauth2.Endpoint{ 28 AuthURL: "https://bitbucket.org/site/oauth2/authorize", 29 TokenURL: "https://bitbucket.org/site/oauth2/access_token", 30 } 31 32 // Cern is the endpoint for CERN. 33 var Cern = oauth2.Endpoint{ 34 AuthURL: "https://oauth.web.cern.ch/OAuth/Authorize", 35 TokenURL: "https://oauth.web.cern.ch/OAuth/Token", 36 } 37 38 // Facebook is the endpoint for Facebook. 39 var Facebook = oauth2.Endpoint{ 40 AuthURL: "https://www.facebook.com/v3.2/dialog/oauth", 41 TokenURL: "https://graph.facebook.com/v3.2/oauth/access_token", 42 } 43 44 // Foursquare is the endpoint for Foursquare. 45 var Foursquare = oauth2.Endpoint{ 46 AuthURL: "https://foursquare.com/oauth2/authorize", 47 TokenURL: "https://foursquare.com/oauth2/access_token", 48 } 49 50 // Fitbit is the endpoint for Fitbit. 51 var Fitbit = oauth2.Endpoint{ 52 AuthURL: "https://www.fitbit.com/oauth2/authorize", 53 TokenURL: "https://api.fitbit.com/oauth2/token", 54 } 55 56 // GitHub is the endpoint for Github. 57 var GitHub = oauth2.Endpoint{ 58 AuthURL: "https://github.com/login/oauth/authorize", 59 TokenURL: "https://github.com/login/oauth/access_token", 60 DeviceAuthURL: "https://github.com/login/device/code", 61 } 62 63 // GitLab is the endpoint for GitLab. 64 var GitLab = oauth2.Endpoint{ 65 AuthURL: "https://gitlab.com/oauth/authorize", 66 TokenURL: "https://gitlab.com/oauth/token", 67 } 68 69 // Google is the endpoint for Google. 70 var Google = oauth2.Endpoint{ 71 AuthURL: "https://accounts.google.com/o/oauth2/auth", 72 TokenURL: "https://oauth2.googleapis.com/token", 73 DeviceAuthURL: "https://oauth2.googleapis.com/device/code", 74 } 75 76 // Heroku is the endpoint for Heroku. 77 var Heroku = oauth2.Endpoint{ 78 AuthURL: "https://id.heroku.com/oauth/authorize", 79 TokenURL: "https://id.heroku.com/oauth/token", 80 } 81 82 // HipChat is the endpoint for HipChat. 83 var HipChat = oauth2.Endpoint{ 84 AuthURL: "https://www.hipchat.com/users/authorize", 85 TokenURL: "https://api.hipchat.com/v2/oauth/token", 86 } 87 88 // Instagram is the endpoint for Instagram. 89 var Instagram = oauth2.Endpoint{ 90 AuthURL: "https://api.instagram.com/oauth/authorize", 91 TokenURL: "https://api.instagram.com/oauth/access_token", 92 } 93 94 // KaKao is the endpoint for KaKao. 95 var KaKao = oauth2.Endpoint{ 96 AuthURL: "https://kauth.kakao.com/oauth/authorize", 97 TokenURL: "https://kauth.kakao.com/oauth/token", 98 } 99 100 // LinkedIn is the endpoint for LinkedIn. 101 var LinkedIn = oauth2.Endpoint{ 102 AuthURL: "https://www.linkedin.com/oauth/v2/authorization", 103 TokenURL: "https://www.linkedin.com/oauth/v2/accessToken", 104 } 105 106 // Mailchimp is the endpoint for Mailchimp. 107 var Mailchimp = oauth2.Endpoint{ 108 AuthURL: "https://login.mailchimp.com/oauth2/authorize", 109 TokenURL: "https://login.mailchimp.com/oauth2/token", 110 } 111 112 // Mailru is the endpoint for Mail.Ru. 113 var Mailru = oauth2.Endpoint{ 114 AuthURL: "https://o2.mail.ru/login", 115 TokenURL: "https://o2.mail.ru/token", 116 } 117 118 // MediaMath is the endpoint for MediaMath. 119 var MediaMath = oauth2.Endpoint{ 120 AuthURL: "https://api.mediamath.com/oauth2/v1.0/authorize", 121 TokenURL: "https://api.mediamath.com/oauth2/v1.0/token", 122 } 123 124 // MediaMathSandbox is the endpoint for MediaMath Sandbox. 125 var MediaMathSandbox = oauth2.Endpoint{ 126 AuthURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/authorize", 127 TokenURL: "https://t1sandbox.mediamath.com/oauth2/v1.0/token", 128 } 129 130 // Microsoft is the endpoint for Microsoft. 131 var Microsoft = oauth2.Endpoint{ 132 AuthURL: "https://login.live.com/oauth20_authorize.srf", 133 TokenURL: "https://login.live.com/oauth20_token.srf", 134 } 135 136 // NokiaHealth is the endpoint for Nokia Health. 137 var NokiaHealth = oauth2.Endpoint{ 138 AuthURL: "https://account.health.nokia.com/oauth2_user/authorize2", 139 TokenURL: "https://account.health.nokia.com/oauth2/token", 140 } 141 142 // Odnoklassniki is the endpoint for Odnoklassniki. 143 var Odnoklassniki = oauth2.Endpoint{ 144 AuthURL: "https://www.odnoklassniki.ru/oauth/authorize", 145 TokenURL: "https://api.odnoklassniki.ru/oauth/token.do", 146 } 147 148 // PayPal is the endpoint for PayPal. 149 var PayPal = oauth2.Endpoint{ 150 AuthURL: "https://www.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize", 151 TokenURL: "https://api.paypal.com/v1/identity/openidconnect/tokenservice", 152 } 153 154 // PayPalSandbox is the endpoint for PayPal Sandbox. 155 var PayPalSandbox = oauth2.Endpoint{ 156 AuthURL: "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize", 157 TokenURL: "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice", 158 } 159 160 // Slack is the endpoint for Slack. 161 var Slack = oauth2.Endpoint{ 162 AuthURL: "https://slack.com/oauth/authorize", 163 TokenURL: "https://slack.com/api/oauth.access", 164 } 165 166 // Spotify is the endpoint for Spotify. 167 var Spotify = oauth2.Endpoint{ 168 AuthURL: "https://accounts.spotify.com/authorize", 169 TokenURL: "https://accounts.spotify.com/api/token", 170 } 171 172 // StackOverflow is the endpoint for Stack Overflow. 173 var StackOverflow = oauth2.Endpoint{ 174 AuthURL: "https://stackoverflow.com/oauth", 175 TokenURL: "https://stackoverflow.com/oauth/access_token", 176 } 177 178 // Strava is the endpoint for Strava. 179 var Strava = oauth2.Endpoint{ 180 AuthURL: "https://www.strava.com/oauth/authorize", 181 TokenURL: "https://www.strava.com/oauth/token", 182 } 183 184 // Twitch is the endpoint for Twitch. 185 var Twitch = oauth2.Endpoint{ 186 AuthURL: "https://id.twitch.tv/oauth2/authorize", 187 TokenURL: "https://id.twitch.tv/oauth2/token", 188 } 189 190 // Uber is the endpoint for Uber. 191 var Uber = oauth2.Endpoint{ 192 AuthURL: "https://login.uber.com/oauth/v2/authorize", 193 TokenURL: "https://login.uber.com/oauth/v2/token", 194 } 195 196 // Vk is the endpoint for Vk. 197 var Vk = oauth2.Endpoint{ 198 AuthURL: "https://oauth.vk.com/authorize", 199 TokenURL: "https://oauth.vk.com/access_token", 200 } 201 202 // Yahoo is the endpoint for Yahoo. 203 var Yahoo = oauth2.Endpoint{ 204 AuthURL: "https://api.login.yahoo.com/oauth2/request_auth", 205 TokenURL: "https://api.login.yahoo.com/oauth2/get_token", 206 } 207 208 // Yandex is the endpoint for Yandex. 209 var Yandex = oauth2.Endpoint{ 210 AuthURL: "https://oauth.yandex.com/authorize", 211 TokenURL: "https://oauth.yandex.com/token", 212 } 213 214 // Zoom is the endpoint for Zoom. 215 var Zoom = oauth2.Endpoint{ 216 AuthURL: "https://zoom.us/oauth/authorize", 217 TokenURL: "https://zoom.us/oauth/token", 218 } 219 220 // AzureAD returns a new oauth2.Endpoint for the given tenant at Azure Active Directory. 221 // If tenant is empty, it uses the tenant called `common`. 222 // 223 // For more information see: 224 // https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols#endpoints 225 func AzureAD(tenant string) oauth2.Endpoint { 226 if tenant == "" { 227 tenant = "common" 228 } 229 return oauth2.Endpoint{ 230 AuthURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/authorize", 231 TokenURL: "https://login.microsoftonline.com/" + tenant + "/oauth2/v2.0/token", 232 } 233 } 234 235 // HipChatServer returns a new oauth2.Endpoint for a HipChat Server instance 236 // running on the given domain or host. 237 func HipChatServer(host string) oauth2.Endpoint { 238 return oauth2.Endpoint{ 239 AuthURL: "https://" + host + "/users/authorize", 240 TokenURL: "https://" + host + "/v2/oauth/token", 241 } 242 } 243 244 // AWSCognito returns a new oauth2.Endpoint for the supplied AWS Cognito domain which is 245 // linked to your Cognito User Pool. 246 // 247 // Example domain: https://testing.auth.us-east-1.amazoncognito.com 248 // 249 // For more information see: 250 // https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-assign-domain.html 251 // https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-userpools-server-contract-reference.html 252 func AWSCognito(domain string) oauth2.Endpoint { 253 domain = strings.TrimRight(domain, "/") 254 return oauth2.Endpoint{ 255 AuthURL: domain + "/oauth2/authorize", 256 TokenURL: domain + "/oauth2/token", 257 } 258 }