1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{Crunchyroll, Result};
use serde_json::json;

impl Crunchyroll {
    /// Verify a device with an code. Generally 6 characters long and used when logging in to non
    /// computer / smartphone devices like PlayStation, Xbox or Android TV.
    pub async fn verify_device(&self, code: String) -> Result<()> {
        let endpoint = "https://www.crunchyroll.com/auth/v1/device";
        self.executor
            .post(endpoint)
            .json(&json!({ "user_code": code }))
            .request_raw()
            .await?;
        Ok(())
    }
}