Initial discord remote auth support.

It works, but nothing is persisted yet as the user object needs some tweaking
especially the database side.
This commit is contained in:
Gary Kramlich
2022-01-04 20:20:45 -06:00
parent 2279916d9c
commit 94104102d2
10 changed files with 581 additions and 23 deletions

29
remoteauth/user.go Normal file
View File

@@ -0,0 +1,29 @@
package remoteauth
import (
"fmt"
"strings"
)
type User struct {
UserID string
Discriminator string
AvatarHash string
Username string
Token string
}
func (u *User) update(payload string) error {
parts := strings.Split(payload, ":")
if len(parts) != 4 {
return fmt.Errorf("expected 4 parts but got %d", len(parts))
}
u.UserID = parts[0]
u.Discriminator = parts[1]
u.AvatarHash = parts[2]
u.Username = parts[3]
return nil
}