feat: account plat native auth handling

This commit is contained in:
amizing25
2026-01-07 17:22:02 +07:00
parent 5ad0ac3556
commit 0208899832
2 changed files with 57 additions and 1 deletions
+5
View File
@@ -90,6 +90,11 @@ pub async fn start_sdkserver() -> Result<()> {
sr_tools::SRTOOLS_UPLOAD_ENDPOINT,
post(sr_tools::sr_tool_save),
)
.route(
auth::APN_LOGIN_BY_PASSWORD_ENDPOINT,
post(auth::apn_login_with_password),
)
.route(auth::APN_VERIFY_TOKEN_ENDPOINT, post(auth::apn_veriy_token))
.layer(
CorsLayer::new()
.allow_origin(Any)
+52 -1
View File
@@ -3,8 +3,11 @@ use serde_json::json;
pub const LOGIN_WITH_PASSWORD_ENDPOINT: &str = "/{product_name}/mdk/shield/api/login";
pub const LOGIN_WITH_SESSION_TOKEN_ENDPOINT: &str = "/{product_name}/mdk/shield/api/verify";
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str = "/{product_name}/combo/granter/login/v2/login";
pub const GRANTER_LOGIN_VERIFICATION_ENDPOINT: &str =
"/{product_name}/combo/granter/login/v2/login";
pub const RISKY_API_CHECK_ENDPOINT: &str = "/account/risky/api/check";
pub const APN_LOGIN_BY_PASSWORD_ENDPOINT: &str = "/account/ma-cn-passport/app/loginByPassword";
pub const APN_VERIFY_TOKEN_ENDPOINT: &str = "/account/ma-cn-session/app/verify";
#[tracing::instrument]
pub async fn login_with_password() -> Json<serde_json::Value> {
@@ -78,3 +81,51 @@ pub async fn risky_api_check() -> Json<serde_json::Value> {
"retcode": 0
}))
}
#[tracing::instrument]
pub async fn apn_login_with_password() -> Json<serde_json::Value> {
Json(json!({
"data": {
"token": {
"token": "mostsecuretokenever",
"token_type": 1
},
"user_info": {
"aid": "1337",
"mid": "1337",
"is_email_verify": 1,
"area_code": "**",
"country": "US",
"is_adult": 1,
"email": "motorized@wheel.chair"
}
},
"message": "OK",
"retcode": 0
}))
}
#[tracing::instrument]
pub async fn apn_veriy_token() -> Json<serde_json::Value> {
Json(json!({
"data": {
"tokens": [
{
"token": "mostsecuretokenever",
"token_type": 1
}
],
"user_info": {
"aid": "1337",
"mid": "1337",
"is_email_verify": 1,
"area_code": "**",
"country": "US",
"is_adult": 1,
"email": "motorized@wheel.chair"
}
},
"message": "OK",
"retcode": 0
}))
}