feat: add some fediverse authentication code

* create applications on instances
* generate authorize URLs
* exchange oauth code for token and user info (untested)
* recreate mastodon app on authentication failure
This commit is contained in:
sam 2024-10-06 15:34:31 +02:00
parent a4ca0902a3
commit 0077a165b5
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
8 changed files with 497 additions and 0 deletions

View file

@ -14,6 +14,15 @@ public class FoxnounsError(string message, Exception? inner = null) : Exception(
public class UnknownEntityError(Type entityType, Exception? inner = null)
: DatabaseError($"Entity of type {entityType.Name} not found", inner);
public class RemoteAuthError(string message, string? errorBody = null, Exception? inner = null)
: FoxnounsError(message, inner)
{
public string? ErrorBody => errorBody;
public override string ToString() =>
$"{Message}: {ErrorBody} {(Inner != null ? $"({Inner})" : "")}";
}
}
public class ApiError(