mirror of
https://codeberg.org/pswilde/fedi_auth
synced 2026-01-14 21:41:33 +00:00
No description
| src | ||
| tests | ||
| .gitignore | ||
| fedi_auth.nimble | ||
| nim.cfg | ||
| readme.md | ||
Fedi Auth
A basic fediverse authentication library for Nim
Usage
Please see tests/login.nim for a working example
let client = newFediClient()
client.instance = "your-home-instance.com"
client.name = "MyReallyCoolApp"
let token = client.getToken()
if client.verify(): echo "Verified!"
You can then use this library to send your own HttpClient requests with the Authorization header:
let c = newHttpClient()
c.headers = newHttpHeaders({
"Authorization": client.tokenStr
})
client.tokenStr is a procedure that simply returns
Bearer YOURTOKEN
Testing
This library has been tested with GoToSocial, Mastodon, Pleroma, Akkoma and Rebased. It should, in theory, work with any fediverse instance that implements MastoAPI endpoints for authentication
---
Have fun!
Any comments, let me know on the fediverse at @paul@notnull.space