Misskey authentication to FastAPI
Project description
FastAPI Misskey
このライブラリはFastAPIにMisskeyの認証を作成するお手伝いをするライブラリです
Example
from typing import Optional
from fastapi import Depends, FastAPI
from fastapi_misskey.client import MisskeyAuthClient
app = FastAPI()
misskey = MisskeyAuthClient(
'https://example.com',
'test',
'http://localhost:8000/callback',
description='FastAPI Misskey Auth'
)
@app.get('/login')
async def login():
return {'url': await misskey.get_auth_url()}
@app.get('/callback')
async def callback(session: Optional[str] = None, token: Optional[str] = None):
token, user = await misskey.get_access_token(session, token)
return {'token': token, 'user': user}
@app.get('/profile')
async def profile(user=Depends(misskey.get_user)):
if user.get('error'):
return user
else:
return {'user': user}
Inspired by
Thanks to @Tert0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi_misskey-0.0.1.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_misskey-0.0.1.tar.gz.
File metadata
- Download URL: fastapi_misskey-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7868f54ca7d3bd929c38e475084fa54b26830d4d2d9ccf7bf907a1bb096edc59
|
|
| MD5 |
fc1907299c5e30802f76b509b54d3f63
|
|
| BLAKE2b-256 |
a84ce6fd66d8cb4284de42ab89f4ffa59034a0fff1e16823a77271ad5caaa318
|
File details
Details for the file fastapi_misskey-0.0.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_misskey-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52a59be30df4f1552ee13b95dab61cae69062b6fe2cff9920ea4bef292281bae
|
|
| MD5 |
478986e720e952f306beb47df20ac811
|
|
| BLAKE2b-256 |
d2bd1cd6a5f476b08df969df897847980722a234d9127718b01f369883d5fee9
|