Watch
1
0
Fork
You've already forked mautrix-discord
0
mirror of https://github.com/mautrix/discord.git synced 2026-11-13 17:49:16 -05:00
mautrix-discord/pkg/remoteauth
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nick Mills-Barrett 3c194c2bf0
login,remoteauth: handle captcha when redeeming login ticket (#256)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Highest <91629626+highesttt@users.noreply.github.com>
Co-authored-by: Indent <noreply@indent.com>
Co-authored-by: Fizzadar <1026154+Fizzadar@users.noreply.github.com>
2026-11-12 16:53:34 -07:00
..
client.go login,remoteauth: handle captcha when redeeming login ticket (#256) 2026-11-12 16:53:34 -07:00
clientpackets.go all: init v2 and delete old bridge 2024-08-15 16:44:23 +03:00
README.md all: init v2 and delete old bridge 2024-08-15 16:44:23 +03:00
serverpackets.go login,remoteauth: handle captcha when redeeming login ticket (#256) 2026-11-12 16:53:34 -07:00
user.go all: init v2 and delete old bridge 2024-08-15 16:44:23 +03:00

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)
}