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.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fastapi_simple_bearer-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.14 Darwin/23.5.0

File hashes

Hashes for fastapi_simple_bearer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4d7f23d025f6dd6434e1ad3da06f7622c4bb4a6a993dff19ca8c3d624af00e20
MD5 b4d9a1ee9b9f658cd6abeae80f5f7d5b
BLAKE2b-256 6a1b8ba5d9f5cbfcfb0cd9d80cf6839ffa5daa2101966b15a9bb2e178079473c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fastapi_simple_bearer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d4be226f949076d720bb3c9ab62b179d91fdee62d951c70d6d1cac8ad5b073c
MD5 94e0bac210707b0a10ab8d9007d94b50
BLAKE2b-256 947784e4ea95346fc91a670eed26115246afedbdf7c753fa4092e23a1c10eadc

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