Skip to content

Commit 31124f0

Browse files
committed
fix as_ref()
1 parent f51a013 commit 31124f0

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

backend/src/twitch/authentication.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
use std::str::FromStr;
2-
use serde_with::DurationSeconds;
3-
use std::time::Duration;
1+
use crate::axum::url_encode;
2+
use crate::commands::twitch_service::OauthCredential;
3+
use crate::service_oauth::oauth_service::OAuthService;
44
use anyhow::Context;
55
use axum::http::method::Method;
66
use axum::http::StatusCode;
77
use serde::{Deserialize, Serialize};
88
use serde_with::serde_as;
9-
use sqlx::types::chrono::{DateTime, Local, NaiveDateTime};
9+
use serde_with::DurationSeconds;
10+
use sqlx::types::chrono::Local;
11+
use std::str::FromStr;
12+
use std::time::Duration;
1013
use url::Url;
11-
use crate::axum::url_encode;
12-
use crate::commands::twitch_service::OauthCredential;
13-
use crate::service_oauth::oauth_service::OAuthService;
1414

1515
#[serde_as]
1616
#[derive(Deserialize)]
@@ -53,7 +53,7 @@ pub async fn validate_token(access_token: impl AsRef<str>) -> anyhow::Result<Opt
5353
.build()
5454
.context("Failed to build client builder for twitch access token validation")?
5555
.request(Method::GET, "https://id.twitch.tv/oauth2/validate")
56-
.header("Authorization", format!("Bearer {}", access_token))
56+
.header("Authorization", format!("Bearer {}", access_token.as_ref()))
5757
.send()
5858
.await
5959
.context("Failed to send access token validation request to twitch")?;
@@ -82,9 +82,9 @@ pub async fn refresh_token(refresh_token: impl AsRef<str>, client_id: impl AsRef
8282
.context("Failed to build client builder for refreshing twitch oauth token")?
8383
.request(Method::GET, "https://id.twitch.tv/oauth2/token")
8484
.json(&RefreshRequest {
85-
refresh_token,
86-
client_id,
87-
client_secret,
85+
refresh_token: refresh_token.as_ref(),
86+
client_id: client_id.as_ref(),
87+
client_secret: client_secret.as_ref(),
8888
grant_type: "refresh_token",
8989
})
9090
.send()

backend/src/twitch/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
pub mod authentication;
2+
#[cfg(not(all()))]
23
mod ideal_twitch_client;

0 commit comments

Comments
 (0)