Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 API_ID_INVALID(api_id/api_hash combination is invalid) #88

Closed
gtjl12 opened this issue Apr 7, 2022 · 4 comments
Closed

400 API_ID_INVALID(api_id/api_hash combination is invalid) #88

gtjl12 opened this issue Apr 7, 2022 · 4 comments

Comments

@gtjl12
Copy link

gtjl12 commented Apr 7, 2022

Hi, thanks for offering so amazing bot. Unfortunately I met a problem.
I got my api_id and api_hash from https://my.telegram.org/apps, checked many times and I'm sure they are right.

App api_id:13******
App api_hash:9e7**************************e21
DC 2

I put them to app.json and ran ytdl_bot.py, finally an error occurred:

pyrogram.errors.exceptions.bad_request_400.ApiIdInvalid: Telegram says: [400 API_ID_INVALID] - The api_id/api_hash combination is invalid (caused by "auth.ImportBotAuthorization")

I've googled that, turned out to be Telegram's fault. API ID that over 5 digits may goes wrong in combination. Telegram said they've fixed this problem but not well for me.

LonamiWebs/Telethon#46
LonamiWebs/Telethon#836
steavy29/Telegram.Net#27

Is there anything I did wrong?Any suggestions ?
By the way, my api_id is 8 digit.

@gtjl12
Copy link
Author

gtjl12 commented Apr 7, 2022

[2022-04-07 07:44:21 session.py:288 I] NetworkTask stopped
[2022-04-07 07:44:21 session.py:174 I] Session stopped
Traceback (most recent call last):
  File "ytdl_bot.py", line 374, in <module>
    app.run()
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/methods/utilities/run.py", line 58, in run
    self.start()
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap
    return loop.run_until_complete(coroutine)
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/methods/utilities/start.py", line 56, in start
    await self.authorize()
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/client.py", line 283, in authorize
    return await self.sign_in_bot(self.bot_token)
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/methods/auth/sign_in_bot.py", line 51, in sign_in_bot
    bot_auth_token=bot_token
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/methods/advanced/send.py", line 81, in send
    else self.sleep_threshold)
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/session/session.py", line 362, in send
    return await self._send(data, timeout=timeout)
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/session/session.py", line 332, in _send
    RPCError.raise_it(result, type(data))
  File "/usr/local/lib64/python3.6/site-packages/pyrogram/errors/rpc_error.py", line 97, in raise_it
    is_signed=is_signed)
pyrogram.errors.exceptions.bad_request_400.ApiIdInvalid: Telegram says: [400 API_ID_INVALID] - The api_id/api_hash combination is invalid (caused by "auth.ImportBotAuthorization")

@BennyThink
Copy link
Member

It appears you're running it on your own Linux server.

You shouldn't put those in app.json, please configure environment variables or modify config.py

@gtjl12
Copy link
Author

gtjl12 commented Apr 7, 2022

Thanks a lot,problem solved! I'm so stupid.
But another problem happened. I will submit a new issue .
Could you help me again?

@gtjl12 gtjl12 closed this as completed Apr 7, 2022
@testerbot11
Copy link

testerbot11 commented May 27, 2022

Thanks a lot,problem solved! I'm so stupid. But another problem happened. I will submit a new issue . Could you help me again?

Can you please help me how you solved the issue? Where do I create environment variable?
For now Im replacing the default values (111,111,3703WLI) with my app id app hash and bot token. Where should i create environmental variables instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants