Skip to main content

The simpliest way to secure your API with preset token

Project description

FastAPI Simple Bearer (FSB)

This library provides you with ability to secure your endpoints with preset token (or tokens) in the "Authorization: Bearer" header

Installation

The easiest way to start working with this library is to install it from pip

pip install fastapi-simple-bearer

Example of usage

Basic usage:

from fastapi import Depends, FastAPI
from fastapi_simple_bearer import FSB, FSBToken

app = FastAPI()

fsb = FSB(token="SUPER_SECRET_TOKEN")

@app.get("/secure")
async def secure(auth: FSBToken = Depends(fsb)):
    return {"token": auth.token}

Other examples are available in examples folder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_simple_bearer-0.1.1.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

fastapi_simple_bearer-0.1.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_simple_bearer-0.1.1.tar.gz.

File metadata

  • Download URL: fastapi_simple_bearer-0.1.1.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for fastapi_simple_bearer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ebac682e66ce245be45dfab56cce47f9f43cb74636845d2a09e5c789bd5c1aa0
MD5 5d1218c2aea32a1ad3c1bac0e6e9d78a
BLAKE2b-256 d30ac4e9207c9650de6fe4c82b98d58fe83a75faf6bb740e8668013fa252e105

See more details on using hashes here.

File details

Details for the file fastapi_simple_bearer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_simple_bearer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4386dbf84981e0e2009c765fd39aa05161c733989b2f0e4da5c9a3a2111ec04
MD5 4f3f53cb11b5677f9a58ecb794d1d3b0
BLAKE2b-256 884c3928d62a4ced21fc488a20b58f34162f6e14b415eff5d50fc30eeb332eca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page