feat(auth): add wechat miniapp customer phone login
Implement Wechat Mini Program phone number login flow for end customers: - add PhoneLoginIn Pydantic request schema - create wechat.py module for Wechat API interactions and phone code exchange - add customer JWT utilities and require_customer authentication dependency - add new public API endpoints: /api/public/auth/phone-login and /api/public/auth/me - add required environment config variables and update example .env - add comprehensive test cases for the new auth flow and endpoints
This commit is contained in:
@@ -13,3 +13,15 @@ def test_oss_settings_are_loaded_from_prefixed_environment(monkeypatch):
|
||||
assert settings.oss_access_key_secret == "example-access-key-secret"
|
||||
assert settings.oss_endpoint == "oss-cn-example.aliyuncs.com"
|
||||
assert settings.oss_bucket_name == "example-bucket"
|
||||
|
||||
|
||||
def test_wechat_miniapp_settings_are_loaded_from_environment(monkeypatch):
|
||||
monkeypatch.setenv("WECHAT_MINIAPP_APPID", "wx-test-appid")
|
||||
monkeypatch.setenv("WECHAT_MINIAPP_SECRET", "test-secret")
|
||||
monkeypatch.setenv("CUSTOMER_JWT_EXPIRES_HOURS", "24")
|
||||
|
||||
settings = Settings(_env_file=None)
|
||||
|
||||
assert settings.wechat_miniapp_appid == "wx-test-appid"
|
||||
assert settings.wechat_miniapp_secret == "test-secret"
|
||||
assert settings.customer_jwt_expires_hours == 24
|
||||
|
||||
Reference in New Issue
Block a user