| 1 |
Providers |
| 2 |
========= |
| 3 |
Flask-Dance comes with pre-set OAuth consumer configurations |
| 4 |
for a few popular OAuth providers. Flask-Dance also works with providers |
| 5 |
that aren't in this list: see the :ref:`Custom <custom-provider>` section |
| 6 |
at the bottom of the page. |
| 7 |
We also welcome pull requests to add new pre-set provider configurations |
| 8 |
to Flask-Dance! |
| 9 |
|
| 10 |
.. contents:: Included Providers |
| 11 |
:local: |
| 12 |
:backlinks: none |
| 13 |
|
| 14 |
Atlassian |
| 15 |
--------- |
| 16 |
.. module:: flask_dance.contrib.atlassian |
| 17 |
|
| 18 |
.. autofunction:: make_atlassian_blueprint |
| 19 |
|
| 20 |
.. data:: atlassian |
| 21 |
|
| 22 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 23 |
already has the Atlassian authentication token loaded (assuming |
| 24 |
that the user has authenticated with Atlassian at some point in the past). |
| 25 |
|
| 26 |
Authentiq |
| 27 |
--------- |
| 28 |
.. module:: flask_dance.contrib.authentiq |
| 29 |
|
| 30 |
.. autofunction:: make_authentiq_blueprint |
| 31 |
|
| 32 |
.. data:: authentiq |
| 33 |
|
| 34 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 35 |
already has the Authentiq Connect authentication token loaded (assuming |
| 36 |
that the user has authenticated with Authentiq at some point in the past). |
| 37 |
|
| 38 |
Azure |
| 39 |
----- |
| 40 |
.. module:: flask_dance.contrib.azure |
| 41 |
|
| 42 |
.. autofunction:: make_azure_blueprint |
| 43 |
|
| 44 |
.. data:: azure |
| 45 |
|
| 46 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 47 |
already has the Azure AD authentication token loaded (assuming that the user |
| 48 |
has authenticated with Azure AD at some point in the past). |
| 49 |
|
| 50 |
Dexcom |
| 51 |
------ |
| 52 |
.. module:: flask_dance.contrib.dexcom |
| 53 |
|
| 54 |
.. autofunction:: make_dexcom_blueprint |
| 55 |
|
| 56 |
.. data:: dexcom |
| 57 |
|
| 58 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 59 |
already has the Dexcom authentication token loaded (assuming that the user |
| 60 |
has authenticated with Dexcom at some point in the past). |
| 61 |
|
| 62 |
Digital Ocean |
| 63 |
------------- |
| 64 |
.. module:: flask_dance.contrib.digitalocean |
| 65 |
|
| 66 |
.. autofunction:: make_digitalocean_blueprint |
| 67 |
|
| 68 |
.. data:: digitalocean |
| 69 |
|
| 70 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 71 |
already has the Digital Ocean authentication token loaded (assuming that |
| 72 |
the user has authenticated with Digital Ocean at some point in the past). |
| 73 |
|
| 74 |
Discord |
| 75 |
------- |
| 76 |
.. module:: flask_dance.contrib.discord |
| 77 |
|
| 78 |
.. autofunction:: make_discord_blueprint |
| 79 |
|
| 80 |
.. data:: discord |
| 81 |
|
| 82 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 83 |
already has the Discord authentication token loaded (assuming that the user |
| 84 |
has authenticated with Discord at some point in the past). |
| 85 |
|
| 86 |
Dropbox |
| 87 |
------- |
| 88 |
.. module:: flask_dance.contrib.dropbox |
| 89 |
|
| 90 |
.. autofunction:: make_dropbox_blueprint |
| 91 |
|
| 92 |
.. data:: dropbox |
| 93 |
|
| 94 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 95 |
already has the Dropbox authentication token loaded (assuming that the user |
| 96 |
has authenticated with Dropbox at some point in the past). |
| 97 |
|
| 98 |
Facebook |
| 99 |
-------- |
| 100 |
.. module:: flask_dance.contrib.facebook |
| 101 |
|
| 102 |
.. autofunction:: make_facebook_blueprint |
| 103 |
|
| 104 |
.. data:: facebook |
| 105 |
|
| 106 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 107 |
already has the Facebook authentication token loaded (assuming that the user |
| 108 |
has authenticated with Facebook at some point in the past). |
| 109 |
|
| 110 |
Fitbit |
| 111 |
------ |
| 112 |
.. module:: flask_dance.contrib.fitbit |
| 113 |
|
| 114 |
.. autofunction:: make_fitbit_blueprint |
| 115 |
|
| 116 |
.. data:: fitbit |
| 117 |
|
| 118 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 119 |
already has the Fitbit authentication token loaded (assuming that the user |
| 120 |
has authenticated with Fitbit at some point in the past). |
| 121 |
|
| 122 |
GitHub |
| 123 |
------ |
| 124 |
.. module:: flask_dance.contrib.github |
| 125 |
|
| 126 |
.. autofunction:: make_github_blueprint |
| 127 |
|
| 128 |
.. data:: github |
| 129 |
|
| 130 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 131 |
already has the GitHub authentication token loaded (assuming that the user |
| 132 |
has authenticated with GitHub at some point in the past). |
| 133 |
|
| 134 |
GitLab |
| 135 |
------ |
| 136 |
.. module:: flask_dance.contrib.gitlab |
| 137 |
|
| 138 |
.. autofunction:: make_gitlab_blueprint |
| 139 |
|
| 140 |
.. data:: gitlab |
| 141 |
|
| 142 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 143 |
already has the GitLab authentication token loaded (assuming that the user |
| 144 |
has authenticated with GitLab at some point in the past). |
| 145 |
|
| 146 |
Google |
| 147 |
------ |
| 148 |
.. module:: flask_dance.contrib.google |
| 149 |
|
| 150 |
.. autofunction:: make_google_blueprint |
| 151 |
|
| 152 |
.. data:: google |
| 153 |
|
| 154 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 155 |
already has the Google authentication token loaded (assuming that the user |
| 156 |
has authenticated with Google at some point in the past). |
| 157 |
|
| 158 |
Heroku |
| 159 |
------ |
| 160 |
.. module:: flask_dance.contrib.heroku |
| 161 |
|
| 162 |
.. autofunction:: make_heroku_blueprint |
| 163 |
|
| 164 |
.. data:: heroku |
| 165 |
|
| 166 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 167 |
already has the Heroku authentication token loaded (assuming that the user |
| 168 |
has authenticated with Heroku at some point in the past). |
| 169 |
|
| 170 |
JIRA |
| 171 |
---- |
| 172 |
.. module:: flask_dance.contrib.jira |
| 173 |
|
| 174 |
.. autofunction:: make_jira_blueprint |
| 175 |
|
| 176 |
.. data:: jira |
| 177 |
|
| 178 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 179 |
already has the JIRA authentication token loaded (assuming that the user |
| 180 |
has authenticated with JIRA at some point in the past). |
| 181 |
|
| 182 |
LinkedIn |
| 183 |
-------- |
| 184 |
.. module:: flask_dance.contrib.linkedin |
| 185 |
|
| 186 |
.. autofunction:: make_linkedin_blueprint |
| 187 |
|
| 188 |
.. data:: linkedin |
| 189 |
|
| 190 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 191 |
already has the LinkedIn authentication token loaded (assuming that the user |
| 192 |
has authenticated with LinkedIn at some point in the past). |
| 193 |
|
| 194 |
Meetup |
| 195 |
------ |
| 196 |
.. module:: flask_dance.contrib.meetup |
| 197 |
|
| 198 |
.. autofunction:: make_meetup_blueprint |
| 199 |
|
| 200 |
.. data:: meetup |
| 201 |
|
| 202 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 203 |
already has the Meetup authentication token loaded (assuming that the user |
| 204 |
has authenticated with Meetup at some point in the past). |
| 205 |
|
| 206 |
Nylas |
| 207 |
----- |
| 208 |
.. module:: flask_dance.contrib.nylas |
| 209 |
|
| 210 |
.. autofunction:: make_nylas_blueprint |
| 211 |
|
| 212 |
.. data:: nylas |
| 213 |
|
| 214 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 215 |
already has the Nylas authentication token loaded (assuming that the user |
| 216 |
has authenticated with Nylas at some point in the past). |
| 217 |
|
| 218 |
OpenStreetMap |
| 219 |
------------- |
| 220 |
.. module:: flask_dance.contrib.osm |
| 221 |
|
| 222 |
.. autofunction:: make_osm_blueprint |
| 223 |
|
| 224 |
.. data:: osm |
| 225 |
|
| 226 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 227 |
already has the OpenStreetMap authentication token loaded (assuming that the user |
| 228 |
has authenticated with OpenStreetMap at some point in the past). |
| 229 |
|
| 230 |
ORCID |
| 231 |
------------- |
| 232 |
.. module:: flask_dance.contrib.orcid |
| 233 |
|
| 234 |
.. autofunction:: make_orcid_blueprint |
| 235 |
|
| 236 |
.. data:: orcid |
| 237 |
|
| 238 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 239 |
already has the ORCID (or sandbox ORCID) authentication token loaded (assuming |
| 240 |
that the user has authenticated with ORCID at some point in the past). |
| 241 |
|
| 242 |
Reddit |
| 243 |
------ |
| 244 |
.. module:: flask_dance.contrib.reddit |
| 245 |
|
| 246 |
.. autofunction:: make_reddit_blueprint |
| 247 |
|
| 248 |
.. data:: reddit |
| 249 |
|
| 250 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 251 |
already has the Reddit authentication token loaded (assuming that the user |
| 252 |
has authenticated with Reddit at some point in the past). |
| 253 |
|
| 254 |
Salesforce |
| 255 |
---------- |
| 256 |
.. module:: flask_dance.contrib.salesforce |
| 257 |
|
| 258 |
.. autofunction:: make_salesforce_blueprint |
| 259 |
|
| 260 |
.. data:: salesforce |
| 261 |
|
| 262 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 263 |
already has the Salesforce authentication token loaded (assuming |
| 264 |
that the user has authenticated with Salesforce at some point in the past). |
| 265 |
|
| 266 |
Slack |
| 267 |
----- |
| 268 |
.. module:: flask_dance.contrib.slack |
| 269 |
|
| 270 |
.. autofunction:: make_slack_blueprint |
| 271 |
|
| 272 |
.. data:: slack |
| 273 |
|
| 274 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 275 |
already has the Slack authentication token loaded (assuming that the user |
| 276 |
has authenticated with Slack at some point in the past). |
| 277 |
|
| 278 |
Strava |
| 279 |
------ |
| 280 |
.. module:: flask_dance.contrib.strava |
| 281 |
|
| 282 |
.. autofunction:: make_strava_blueprint |
| 283 |
|
| 284 |
.. data:: strava |
| 285 |
|
| 286 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 287 |
already has the Strava authentication token loaded (assuming that the user |
| 288 |
has authenticated with Strava at some point in the past). |
| 289 |
|
| 290 |
Twitch |
| 291 |
------- |
| 292 |
.. module:: flask_dance.contrib.twitch |
| 293 |
|
| 294 |
.. autofunction:: make_twitch_blueprint |
| 295 |
|
| 296 |
.. data:: twitch |
| 297 |
|
| 298 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 299 |
already has the Twitch authentication token loaded (assuming that the user |
| 300 |
has authenticated with Twitch at some point in the past). |
| 301 |
|
| 302 |
Spotify |
| 303 |
------- |
| 304 |
.. module:: flask_dance.contrib.spotify |
| 305 |
|
| 306 |
.. autofunction:: make_spotify_blueprint |
| 307 |
|
| 308 |
.. data:: spotify |
| 309 |
|
| 310 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 311 |
already has the Spotify authentication token loaded (assuming that the user |
| 312 |
has authenticated with Spotify at some point in the past). |
| 313 |
|
| 314 |
Zoho |
| 315 |
---- |
| 316 |
.. module:: flask_dance.contrib.zoho |
| 317 |
|
| 318 |
.. autofunction:: make_zoho_blueprint |
| 319 |
|
| 320 |
.. data:: zoho |
| 321 |
|
| 322 |
A :class:`~werkzeug.local.LocalProxy` to a :class:`requests.Session` that |
| 323 |
already has the Zoho authentication token loaded (assuming that the user |
| 324 |
has authenticated with Zoho at some point in the past). |
| 325 |
|
| 326 |
.. _custom-provider: |
| 327 |
|
| 328 |
Custom |
| 329 |
------ |
| 330 |
|
| 331 |
Flask-Dance allows you to build authentication blueprints for any OAuth |
| 332 |
provider, not just the ones listed above. For example, let's create a blueprint |
| 333 |
for a fictional OAuth provider called oauth-example.com. We check the |
| 334 |
documentation for oauth-example.com, and discover that they're using OAuth 2, |
| 335 |
the access token URL is ``https://oauth-example.com/login/access_token``, |
| 336 |
and the authorization URL is ``https://oauth-example.com/login/authorize``. |
| 337 |
We could then build the blueprint like this: |
| 338 |
|
| 339 |
.. code-block:: python |
| 340 |
|
| 341 |
from flask import Flask |
| 342 |
from flask_dance.consumer import OAuth2ConsumerBlueprint |
| 343 |
|
| 344 |
app = Flask(__name__) |
| 345 |
example_blueprint = OAuth2ConsumerBlueprint( |
| 346 |
"oauth-example", __name__, |
| 347 |
client_id="my-key-here", |
| 348 |
client_secret="my-secret-here", |
| 349 |
base_url="https://oauth-example.com", |
| 350 |
token_url="https://oauth-example.com/login/access_token", |
| 351 |
authorization_url="https://oauth-example.com/login/authorize", |
| 352 |
) |
| 353 |
app.register_blueprint(example_blueprint, url_prefix="/login") |
| 354 |
|
| 355 |
Now, in your page template, you can do something like: |
| 356 |
|
| 357 |
.. code-block:: jinja |
| 358 |
|
| 359 |
<a href="{{ url_for("oauth-example.login") }}">Login with OAuth Example</a> |
| 360 |
|
| 361 |
And in your views, you can make authenticated requests using the |
| 362 |
:attr:`~flask_dance.consumer.OAuth2ConsumerBlueprint.session` attribute on the |
| 363 |
blueprint: |
| 364 |
|
| 365 |
.. code-block:: python |
| 366 |
|
| 367 |
resp = example_blueprint.session.get("/user") |
| 368 |
assert resp.ok |
| 369 |
print("Here's the content of my response: " + resp.content) |
| 370 |
|
| 371 |
It all follows the same patterns as the :doc:`quickstart` example projects. |
| 372 |
You can also read the code to see how the pre-set configurations are |
| 373 |
implemented -- it's very short. |