1
0
Fork
You've already forked fedi_auth
0
forked from pswilde/fedi_auth
A basic Nim library to establish basic authentication with fediverse instances
  • Nim 100%
2025年04月21日 22:44:26 +00:00
src Обновить src/fedi_auth.nim 2025年04月21日 22:41:24 +00:00
tests exported from gts_emoji_importer 2023年09月27日 15:55:07 +01:00
.gitignore exported from gts_emoji_importer 2023年09月27日 15:55:07 +01:00
fedi_auth.nimble Обновить fedi_auth.nimble 2025年04月21日 22:44:26 +00:00
nim.cfg exported from gts_emoji_importer 2023年09月27日 15:55:07 +01:00
readme.md updated readme 2023年09月27日 15:58:36 +01:00

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