MCPcopy Create free account
hub / github.com/HiddenCodeDevs/BlumTelegramBot / auth_with_web_data

Method auth_with_web_data

bot/core/api.py:65–78  ·  view source on GitHub ↗
(self, web_data)

Source from the content-addressed store, hash-verified

63 return response
64
65 async def auth_with_web_data(self, web_data) -> dict:
66 resp = await self.post(url=f"{self.user_url}/api/v1/auth/provider/PROVIDER_TELEGRAM_MINI_APP", data=web_data)
67 resp_json = await resp.json()
68 if resp.status == 200:
69 return resp_json
70 if resp.status == 520:
71 raise NeedReLoginError()
72 if resp.status == 500 and "Invalid username" in resp_json.get('message'):
73 raise InvalidUsernameError(f"response data: {resp_json.get('message')}")
74 if resp.status == 500 and "account is already connected" in resp_json.get('message'):
75 raise AlreadyConnectError(f"response data: {resp_json.get('message')}")
76 if resp.status == 409:
77 raise UsernameNotAvailableError(f"response data: {resp_json.get('message')}")
78 raise Exception(f"error auth_with_web_data. resp[{resp.status}]: {resp_json}")
79
80
81 async def login(self, web_data_params: str):

Callers 1

loginMethod · 0.95

Calls 6

postMethod · 0.95
NeedReLoginErrorClass · 0.90
AlreadyConnectErrorClass · 0.90
getMethod · 0.80

Tested by

no test coverage detected