mirror of
https://github.com/mautrix/discord.git
synced 2026-11-11 08:39:18 -05:00
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Discord may challenge the remote auth ticket exchange with an hCaptcha, which previously ended the QR login. Return the same cookies step the machine login uses and retry the redeem with the solution. The hello timeout goroutine also no longer calls Close while holding the client lock, which deadlocked once the timeout elapsed mid-captcha. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
| .. | ||
| client.go | ||
| clientpackets.go | ||
| README.md | ||
| serverpackets.go | ||
| user.go | ||
Discord Remote Authentication
This library implements the desktop side of Discord's remote authentication protocol.
It is completely based off of the Unofficial Discord API Documentation.
Example
package main
import (
"context"
"fmt"
"github.com/skip2/go-qrcode"
)
func main() {
client, err := New()
if err != nil {
fmt.Printf("error: %v\n", err)
return
}
ctx := context.Background()
qrChan := make(chan *qrcode.QRCode)
go func() {
qrCode := <-qrChan
fmt.Println(qrCode.ToSmallString(true))
}()
doneChan := make(chan struct{})
if err := client.Dial(ctx, qrChan, doneChan); err != nil {
close(qrChan)
close(doneChan)
fmt.Printf("dial error: %v\n", err)
return
}
<-doneChan
user, err := client.Result()
fmt.Printf("user: %q\n", user)
fmt.Printf("err: %v\n", err)
}