discord-qr-auth 0.1.0

A Rust library to authenticate with Discord using QR codes.
Documentation

discord-qr-auth

discord-qr-auth is a Rust library that lets you authenticate users using QR codes.

Example

use qrcode::render::unicode;
use discord_qr_auth::core::websocket::Client;

#[tokio::main]
async fn main() {
    let mut ws = Client::default();
    ws.connect().await.unwrap();
    let qr = ws.get_code().await.unwrap();

    let image = qr
        .render::<unicode::Dense1x2>()
        .dark_color(unicode::Dense1x2::Light)
        .light_color(unicode::Dense1x2::Dark)
        .build();
    println!("{}\nScan this QR code in the Discord app on your phone.", image);

    let user = ws.get_user().await.unwrap();

    println!("User {} scanned QR code!", user.username);

    let token = ws.get_token().await.unwrap();

    println!("User accepted log-in. Token: {}", token);
}