authlib / authlib/authlib

Add async Flask OAuth client

Open
#818 1 comment 0 reactions 0 assignees View on GitHub
integration:flask role:client
Dominant language
Python
Stars
5.4k
Forks
563
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

The [Flask OAuth client](https://docs.authlib.org/en/latest/client/flask.html) uses Requests and is thus synchronous. Although Flask is a predominately a synchronous web framework, it does support [asynchronous views](https://flask.palletsprojects.com/en/stable/async-await/). This raises the possibility of an async Flask view wanting to use an async OAuth client.

This may also apply to the Django OAuth client.

**Describe the solution you'd like**

An async variant of `FlaskOAuth2App` that uses HTTPX.

**Describe alternatives you've considered**

Current workaround is to create a custom OAuth app:

```python
class AsyncFlaskOAuth2App(AsyncOAuth2Mixin, AsyncOpenIDMixin, BaseApp):
client_cls = AsyncOAuth2Client

oauth = OAuth(app)
oauth.register(
client_cls=AsyncFlaskOAuth2App,
...
)
```

**Additional context**

N/A

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.