Skip to content

Repository files navigation

FastLink

OAuth 2.0 client for various platforms, asynchronous, easy-to-use, extensible


TestCodeQL Advanced


Features

  • All-in-one: Supports popular platforms like Google, Yandex, Telegram, etc.
  • Asynchronous: Built on top of httpx is fully asynchronous.
  • Easy-to-use: Simple and intuitive API for quick integration.
  • Extensible: Easily add support for new platforms or customize existing ones.

Installation

pip install fastlink

Get Started

fromtypingimportAnnotated, AnyfromfastapiimportDepends, FastAPIfromfastapi.responsesimportRedirectResponsefromexamples.configimportsettingsfromfastlinkimportGoogleSSOfromfastlink.schemasimportOAuth2Callback, OpenIDapp=FastAPI()
sso=GoogleSSO(
settings.google_client_id,
settings.google_client_secret,
"http://localhost:8000/callback",
)
@app.get("/login")asyncdeflogin() ->RedirectResponse:
asyncwithsso:
url=awaitsso.login_url()
returnRedirectResponse(url=url)
@app.get("/callback")asyncdefcallback(call: Annotated[OAuth2Callback, Depends()]) ->OpenID:
asyncwithsso:
returnawaitsso.callback(call)

Now you can run the server and visit http://localhost:8000/login to start the OAuth 2.0 flow.

screenshot-1738081195921.png

After logging into Google, you will be redirected to the callback URL. The server will then fetch the user's OpenID information and return it as a response. screenshot-1738081352079.png

About

FastLink OAuth 2.0 client for various platforms, asynchronous, easy-to-use, extensible

Topics

Resources

Code of conduct

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages