log redirect uri
All checks were successful
Build and Test / account (push) Successful in 3m27s

This commit is contained in:
red binder 2026-08-08 21:11:30 +02:00
commit 8c01e2d5fd
2 changed files with 4 additions and 3 deletions

View file

@ -65,12 +65,13 @@ pub async fn authorize_submit(
let expires_at = Utc::now().naive_utc() + Duration::minutes(5);
if let Err(db_err) = sqlx::query(
"INSERT INTO oauth_auth_codes (code, pid, redirect_uri, expires_at) VALUES ($1, $2, $3, $4)"
"INSERT INTO oauth_auth_codes (code, pid, redirect_uri, expires_at, client_id) VALUES ($1, $2, $3, $4, $5)"
)
.bind(&secure_auth_code)
.bind(pid)
.bind(form_data.redirect_uri)
.bind(expires_at)
.bind(form_data.client_id)
.execute(pool.inner())
.await {
eprintln!("failed to save auth code: {:?}", db_err);

View file

@ -33,8 +33,6 @@ pub struct TokenRequest<'r> {
}
pub fn verify_nintendo_password(pid: i32, text_password: &str, db_bcrypt_hash: &str) -> bool {
// maple: binder, there's already a function for this, why duplicate code?
// binder: dear maple, with this function i can just hand it a pid, the password from the user and the db_bcrypt_hash and it gives me a true/false value.
let mut sha = Sha256::new();
sha.update(bytes_of(&pid));
sha.update(&[0x02, 0x65, 0x43, 0x46]);
@ -54,6 +52,8 @@ pub async fn generate_token(
pool: &State<Pool>,
form_data: Form<TokenRequest<'_>>,
) -> Result<Json<OAuthTokenResponse>, (Status, Json<OAuthErrorResponse>)> {
println!("redirect URI is: {:?}", form_data.redirect_uri);
match form_data.client_id {
Some("account") | Some("splatnet") => {
let cl_secret: String = CLIENT_SECRET.clone();