(
config: &OAuthProviderConfig,
auth_url: &str,
token_url: &str,
redirect_url: &str,
)
| 278 | .as_i64() |
| 279 | .filter(|id| *id > 0) |
| 280 | .ok_or_else(|| AppError::Internal("GitHub userinfo missing valid id".to_string()))? |
| 281 | .to_string(); |
| 282 | |
| 283 | Ok(OAuthUserInfo { |
| 284 | provider_user_id, |
| 285 | email: resp["email"].as_str().map(str::to_string), |
| 286 | display_name: resp["login"] |
| 287 | .as_str() |
| 288 | .or(resp["name"].as_str()) |
| 289 | .map(str::to_string), |
| 290 | }) |
| 291 | } |
| 292 | |
| 293 | fn parse_google_user_info(resp: &serde_json::Value) -> Result<OAuthUserInfo, AppError> { |
| 294 | let provider_user_id = resp["sub"] |
| 295 | .as_str() |
| 296 | .filter(|id| !id.trim().is_empty()) |
no test coverage detected