[GH-ISSUE #110] Ask user for user id instead of chat id (aka simpler Telegram setup) #36

Open
opened 2026-02-26 05:32:32 +03:00 by kerem · 50 comments
Owner

Originally created by @Dretech on GitHub (Sep 18, 2018).
Original GitHub issue: https://github.com/nextcloud/twofactor_gateway/issues/110

I'm pleasantly surprised that the Telegram 2fa is integrated in the easily installable apps for Nextcloud 14. Unfortunately I was not able to enable the Telegram 2fa after following the instructions from the app and the 2fa gateway website.
In the security settings of my user I tried to enter my Telegram ID, but the app responds with the following error message:
afbeelding
(In the input field I filled in my Telegram ID, but I don't want to show this ID on a public website)

What is going wrong?

Thanks in advance for your reply.

André

Originally created by @Dretech on GitHub (Sep 18, 2018). Original GitHub issue: https://github.com/nextcloud/twofactor_gateway/issues/110 I'm pleasantly surprised that the Telegram 2fa is integrated in the easily installable apps for Nextcloud 14. Unfortunately I was not able to enable the Telegram 2fa after following the instructions from the app and the 2fa gateway website. In the security settings of my user I tried to enter my Telegram ID, but the app responds with the following error message: ![afbeelding](https://user-images.githubusercontent.com/10683755/45676671-8b9ed000-bb32-11e8-8640-a1f35580e7a3.png) (In the input field I filled in my Telegram ID, but I don't want to show this ID on a public website) What is going wrong? Thanks in advance for your reply. André
Author
Owner

@ChristophWurst commented on GitHub (Sep 18, 2018):

Hey, @Dretech :)

So, you've set up a new bot, started a conversation from your Telegram user and checked the ID with the "ID Bot", correct? Is that the ID you entered?

Is there anything in your data/nextcloud.log?

<!-- gh-comment-id:422317279 --> @ChristophWurst commented on GitHub (Sep 18, 2018): Hey, @Dretech :) So, you've set up a new bot, started a conversation from your Telegram user and checked the ID with the "ID Bot", correct? Is that the ID you entered? Is there anything in your `data/nextcloud.log`?
Author
Owner

@Dretech commented on GitHub (Sep 18, 2018):

Hi Christoph,

Thank you for your quick reply.

So, you've set up a new bot, started a conversation from your Telegram user and checked the ID with the "ID Bot", correct? Is that the ID you entered?

Yes, I did

The last line of my nextcloud.log file is:
{"reqId":"1EwDcbHK7ZqakRFYR4kc","level":3,"time":"2018-09-18T18:08:11+00:00","remoteAddr":"192.168.2.1","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

The latest version of php-intl is installed. So what is causing this error?

<!-- gh-comment-id:422505139 --> @Dretech commented on GitHub (Sep 18, 2018): Hi Christoph, Thank you for your quick reply. > So, you've set up a new bot, started a conversation from your Telegram user and checked the ID with the "ID Bot", correct? Is that the ID you entered? Yes, I did The last line of my nextcloud.log file is: `{"reqId":"1EwDcbHK7ZqakRFYR4kc","level":3,"time":"2018-09-18T18:08:11+00:00","remoteAddr":"192.168.2.1","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}` The latest version of php-intl is installed. So what is causing this error?
Author
Owner

@ChristophWurst commented on GitHub (Sep 19, 2018):

The latest version of php-intl is installed. So what is causing this error?

This doesn't read like it would cause any problems here.

<!-- gh-comment-id:422663061 --> @ChristophWurst commented on GitHub (Sep 19, 2018): > The latest version of php-intl is installed. So what is causing this error? This doesn't read like it would cause any problems here.
Author
Owner

@Dretech commented on GitHub (Sep 25, 2018):

Thank you for your reply.

Can you describe which records in the database are made (and what contents they must have) after Telegram 2fa is activated? (The Telegram 2fa app has changed since I made the first version).

<!-- gh-comment-id:424294292 --> @Dretech commented on GitHub (Sep 25, 2018): Thank you for your reply. Can you describe which records in the database are made (and what contents they must have) after Telegram 2fa is activated? (The Telegram 2fa app has changed since I made the first version).
Author
Owner

@ChristophWurst commented on GitHub (Sep 25, 2018):

Take a look at the admin docs: https://github.com/nextcloud/twofactor_gateway/tree/master/doc/admin#telegram

<!-- gh-comment-id:424462161 --> @ChristophWurst commented on GitHub (Sep 25, 2018): Take a look at the admin docs: https://github.com/nextcloud/twofactor_gateway/tree/master/doc/admin#telegram
Author
Owner

@Dretech commented on GitHub (Sep 26, 2018):

I followed the instructions in the admin docs. I can't find anything in the admin docs about which database records will be created after enabling 2fa with Telegram for u user.

<!-- gh-comment-id:424824306 --> @Dretech commented on GitHub (Sep 26, 2018): I followed the instructions in the admin docs. I can't find anything in the admin docs about which database records will be created after enabling 2fa with Telegram for u user.
Author
Owner

@ChristophWurst commented on GitHub (Sep 27, 2018):

You don't (and shouldn't) change any database values manually, the interactive commands will do that for you. That's what they are for 😉

Once that's done, go to your personal settings in the Nextcloud UI and you'll find the gateway user settings in the security section.

<!-- gh-comment-id:424958404 --> @ChristophWurst commented on GitHub (Sep 27, 2018): You don't (and shouldn't) change any database values manually, the interactive commands will do that for you. That's what they are for :wink: Once that's done, go to your personal settings in the Nextcloud UI and you'll find the gateway user settings in the security section.
Author
Owner

@Dretech commented on GitHub (Sep 27, 2018):

After running occ twofactorauth:gateway:configure telegram I entered my Telegram Bot token and I got the message `Using -my Telegram bot token-

After that I tried to fill in my Telegram ID in the personal - security settings of the web interface of Nextcloud. After entering my Telegram id I got the next error message (see enclosed printscreen). (Before making the printscreen I changed my Telegram ID to 999999999, but the error message is concerning my real Telegram ID).

printscreen
`

<!-- gh-comment-id:425202438 --> @Dretech commented on GitHub (Sep 27, 2018): After running `occ twofactorauth:gateway:configure telegram` I entered my Telegram Bot token and I got the message `Using -my Telegram bot token- After that I tried to fill in my Telegram ID in the personal - security settings of the web interface of Nextcloud. After entering my Telegram id I got the next error message (see enclosed printscreen). (Before making the printscreen I changed my Telegram ID to 999999999, but the error message is concerning my real Telegram ID). ![printscreen](https://user-images.githubusercontent.com/10683755/46167551-5a42a480-c296-11e8-8921-724efe73a06f.PNG) `
Author
Owner

@ChristophWurst commented on GitHub (Sep 28, 2018):

Did you receive a code after entering your telegram ID?

How did you update to the latest version of this app? Are there any entries in your nextcloud.log when that error occurs?

<!-- gh-comment-id:425323694 --> @ChristophWurst commented on GitHub (Sep 28, 2018): Did you receive a code after entering your telegram ID? How did you update to the latest version of this app? Are there any entries in your nextcloud.log when that error occurs?
Author
Owner

@Dretech commented on GitHub (Sep 28, 2018):

No, I did not receive a code after entering my Telegram (user) ID.

I installed the app from the apps menu (in the right top of Nextcldoud) see printscreen below.
afbeelding . My current version of Nextcloud is: 14.0.0

Below you will find today's records of nextcloud.log containing 'Telegram':

{"reqId":"mOsBT7MIOzjPmKkqCDXJ","level":3,"time":"2018-09-28T18:24:38+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"GET","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

{"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'message' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

{"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'chat' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

{"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-
28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'id' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

{"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"index","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":{"Exception":"UnexpectedValueException","Message":"Only integers, floats and strings are allowed as value","Code":0,"Trace":[{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":93,"function":"setUserValue","class":"OC\\AllConfig","type":"->","args":["andre","twofactor_gateway","chat_id",null]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":67,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},277245919]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"277245919","004324 is your Nextcloud verification code."]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","277245919"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","277245919"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/base.php","line":989,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/usr\/share\/webapps\/nextcloud\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AllConfig.php","Line":214,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

{"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"}

<!-- gh-comment-id:425530776 --> @Dretech commented on GitHub (Sep 28, 2018): No, I did not receive a code after entering my Telegram (user) ID. I installed the app from the apps menu (in the right top of Nextcldoud) see printscreen below. ![afbeelding](https://user-images.githubusercontent.com/10683755/46226085-7a886700-c35b-11e8-91bd-34c5c4b5e9d1.png) . My current version of Nextcloud is: 14.0.0 Below you will find today's records of nextcloud.log containing 'Telegram': ``` {"reqId":"mOsBT7MIOzjPmKkqCDXJ","level":3,"time":"2018-09-28T18:24:38+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"GET","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} {"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'message' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} {"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'chat' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} {"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09- 28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"Trying to get property 'id' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} {"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"index","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":{"Exception":"UnexpectedValueException","Message":"Only integers, floats and strings are allowed as value","Code":0,"Trace":[{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":93,"function":"setUserValue","class":"OC\\AllConfig","type":"->","args":["andre","twofactor_gateway","chat_id",null]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":67,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},277245919]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"277245919","004324 is your Nextcloud verification code."]},{"file":"\/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","277245919"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","277245919"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/usr\/share\/webapps\/nextcloud\/lib\/base.php","line":989,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/usr\/share\/webapps\/nextcloud\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/usr\/share\/webapps\/nextcloud\/lib\/private\/AllConfig.php","Line":214,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} {"reqId":"9Cv5wGU3gFbBr6ZtG4mF","level":3,"time":"2018-09-28T18:25:49+00:00","remoteAddr":"192.168.2.203","user":"andre","app":"PHP","method":"POST","url":"\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.0.19"} ```
Author
Owner

@MartinGE47 commented on GitHub (Sep 30, 2018):

I have the same problem. Some one can help us

<!-- gh-comment-id:425727577 --> @MartinGE47 commented on GitHub (Sep 30, 2018): I have the same problem. Some one can help us
Author
Owner

@ChristophWurst commented on GitHub (Oct 1, 2018):

Trying to get property 'message' of non-object at /usr/share/webapps/nextcloud/apps/twofactor_gateway/lib/Service/Gateway/Telegram/Gateway.php#92

So somewhere around github.com/nextcloud/twofactor_gateway@1f855c5568/lib/Service/Gateway/Telegram/Gateway.php (L82-L95).

Could you manually check the updates on your bot to see if they contain the event of a new conversation with your user?

<!-- gh-comment-id:425851926 --> @ChristophWurst commented on GitHub (Oct 1, 2018): >Trying to get property 'message' of non-object at \/usr\/share\/webapps\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php#92 So somewhere around https://github.com/nextcloud/twofactor_gateway/blob/1f855c55681794d2faa6602bc0fb5e10045de919/lib/Service/Gateway/Telegram/Gateway.php#L82-L95. Could you manually check the updates on your bot to see if they contain the event of a new conversation with your user?
Author
Owner

@Dretech commented on GitHub (Oct 1, 2018):

It seems Nextcloud does not connect to Telegram. After trying to enable Telegram 2fa in Nextcloud the status of the Telegram Api is:

afbeelding
After sending a message to the Nextcloud 2fa bot I created in the Telegram app the status of the Telegram APi is:
afbeelding

The full conents of the json repsonse is:

{"ok":true,"result":[{"update_id":562736860,
"message":{"message_id":3,"from":{"id":999999999,"is_bot":false,"first_name":"Andr\u00e9","last_name":"from Holland","language_code":"nl"},"chat":{"id":99999999,"first_name":"Andr\u00e9","last_name":"Fondse","type":"private"},"date":1538418166,"text":"Test"}}]}

Tonight I also tested the first version of the Telegram 2fa code I created and that is still working.

<!-- gh-comment-id:426015326 --> @Dretech commented on GitHub (Oct 1, 2018): It seems Nextcloud does not connect to Telegram. After trying to enable Telegram 2fa in Nextcloud the status of the Telegram Api is: ![afbeelding](https://user-images.githubusercontent.com/10683755/46307348-f29e9900-c5b6-11e8-81b6-6fd7e953c15b.png) After sending a message to the Nextcloud 2fa bot I created in the Telegram app the status of the Telegram APi is: ![afbeelding](https://user-images.githubusercontent.com/10683755/46308087-077c2c00-c5b9-11e8-8af7-1cba1636f830.png) The full conents of the json repsonse is: ``` {"ok":true,"result":[{"update_id":562736860, "message":{"message_id":3,"from":{"id":999999999,"is_bot":false,"first_name":"Andr\u00e9","last_name":"from Holland","language_code":"nl"},"chat":{"id":99999999,"first_name":"Andr\u00e9","last_name":"Fondse","type":"private"},"date":1538418166,"text":"Test"}}]} ``` Tonight I also tested the first version of the Telegram 2fa code I created and that is still working.
Author
Owner

@ChristophWurst commented on GitHub (Oct 1, 2018):

After sending a message to the Nextcloud 2fa bot I created in the Telegram app the status of the Telegram APi is:

You have to first contact the bot before you will be able to send messages as a bot. That is how you can use bots to send authentication code. The bot is not allowed to initiate the conversation.

Does it work now? Can you enter the ID you got from the id bot and receive a confirmation message?

<!-- gh-comment-id:426019011 --> @ChristophWurst commented on GitHub (Oct 1, 2018): > After sending a message to the Nextcloud 2fa bot I created in the Telegram app the status of the Telegram APi is: You *have to* first contact the bot before you will be able to send messages as a bot. That is how you can use bots to send authentication code. The bot is not allowed to initiate the conversation. Does it work now? Can you enter the ID you got from the *id bot* and receive a confirmation message?
Author
Owner

@Dretech commented on GitHub (Oct 2, 2018):

No, it does not work now. I don't get a conformation message after sending my Telegram ID. I forgot to write that in the message yesterday.

<!-- gh-comment-id:426211810 --> @Dretech commented on GitHub (Oct 2, 2018): No, it does not work now. I don't get a conformation message after sending my Telegram ID. I forgot to write that in the message yesterday.
Author
Owner

@ChristophWurst commented on GitHub (Oct 2, 2018):

I will try to add more debug logging to the Telegram code to help debug these scenarios.

<!-- gh-comment-id:426290531 --> @ChristophWurst commented on GitHub (Oct 2, 2018): I will try to add more debug logging to the Telegram code to help debug these scenarios.
Author
Owner

@Dretech commented on GitHub (Oct 2, 2018):

Thanks

<!-- gh-comment-id:426358097 --> @Dretech commented on GitHub (Oct 2, 2018): Thanks
Author
Owner

@mmartinortiz commented on GitHub (Oct 5, 2018):

I'm having a similar issue. I use the same bot in other applications for getting notifications from my server, so I guess it is up and working properly (we do not need to create any special command on the bot, right?).

After introducing the Chat ID obtained with the get_id bot, I see the following exception in the nextcloud.log (extract)

"message": {"Exception":"UnexpectedValueException","Message":"Only integers, floats and strings are allowed as value","Code":0," ... }

The value I've introduced is compose by 8 positive integers. I've also tried with the "User Name" provided by the get_id bot

<!-- gh-comment-id:427475675 --> @mmartinortiz commented on GitHub (Oct 5, 2018): I'm having a similar issue. I use the same bot in other applications for getting notifications from my server, so I guess it is up and working properly (we do not need to create any special command on the bot, right?). After introducing the `Chat ID` obtained with the `get_id` bot, I see the following exception in the `nextcloud.log` (extract) ```json "message": {"Exception":"UnexpectedValueException","Message":"Only integers, floats and strings are allowed as value","Code":0," ... } ``` The value I've introduced is compose by 8 positive integers. I've also tried with the "User Name" provided by the `get_id` bot
Author
Owner

@ChristophWurst commented on GitHub (Oct 6, 2018):

@mmartinortiz please see https://github.com/nextcloud/twofactor_gateway/pull/126, test the provided package and report back the debug log entries. Thanks.

<!-- gh-comment-id:427582905 --> @ChristophWurst commented on GitHub (Oct 6, 2018): @mmartinortiz please see https://github.com/nextcloud/twofactor_gateway/pull/126, test the provided package and report back the debug log entries. Thanks.
Author
Owner

@mmartinortiz commented on GitHub (Oct 6, 2018):

Hi @ChristophWurst,

After installing the provided package, this is the last line of nextcloud.log (I did not find other debug data). The Telegram API does not show activity. I've replaced sensitive data.

{
  "reqId": "Jg20asmA0bX4a6kiIFQZ",
  "level": 3,
  "time": "2018-10-07T09:12:17+00:00",
  "remoteAddr": "172.18.0.1",
  "user": "m",
  "app": "index",
  "method": "POST",
  "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start",
  "message": {
    "Exception": "UnexpectedValueException",
    "Message": "Only integers, floats and strings are allowed as value",
    "Code": 0,
    "Trace": [
      {
        "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php",
        "line": 107,
        "function": "setUserValue",
        "class": "OC\\AllConfig",
        "type": "->",
        "args": [
          "m",
          "twofactor_gateway",
          "telegram_chat_id",
          null
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php",
        "line": 75,
        "function": "getChatId",
        "class": "OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          {
            "__class__": "Telegram\\Bot\\Api"
          },
          99999999
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/SetupService.php",
        "line": 92,
        "function": "send",
        "class": "OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          "99999999",
          "666666 is your Nextcloud verification code."
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php",
        "line": 90,
        "function": "startSetup",
        "class": "OCA\\TwoFactorGateway\\Service\\SetupService",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          "telegram",
          "99999999"
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php",
        "line": 166,
        "function": "startVerification",
        "class": "OCA\\TwoFactorGateway\\Controller\\SettingsController",
        "type": "->",
        "args": [
          "telegram",
          "99999999"
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php",
        "line": 99,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\TwoFactorGateway\\Controller\\SettingsController"
          },
          "startVerification"
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/App.php",
        "line": 118,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\TwoFactorGateway\\Controller\\SettingsController"
          },
          "startVerification"
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php",
        "line": 47,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\TwoFactorGateway\\Controller\\SettingsController",
          "startVerification",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "gateway": "telegram",
            "_route": "twofactor_gateway.settings.startVerification"
          }
        ]
      },
      {
        "function": "__invoke",
        "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
        "type": "->",
        "args": [
          {
            "gateway": "telegram",
            "_route": "twofactor_gateway.settings.startVerification"
          }
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/private\/Route\/Router.php",
        "line": 297,
        "function": "call_user_func",
        "args": [
          {
            "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
          },
          {
            "gateway": "telegram",
            "_route": "twofactor_gateway.settings.startVerification"
          }
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/lib\/base.php",
        "line": 987,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"
        ]
      },
      {
        "file": "\/config\/www\/nextcloud\/index.php",
        "line": 42,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": [
          
        ]
      }
    ],
    "File": "\/config\/www\/nextcloud\/lib\/private\/AllConfig.php",
    "Line": 214,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0",
  "version": "14.0.2.0"
}
<!-- gh-comment-id:427586532 --> @mmartinortiz commented on GitHub (Oct 6, 2018): Hi @ChristophWurst, After installing the provided package, this is the last line of `nextcloud.log` (I did not find other debug data). The Telegram API does not show activity. I've replaced sensitive data. ```json { "reqId": "Jg20asmA0bX4a6kiIFQZ", "level": 3, "time": "2018-10-07T09:12:17+00:00", "remoteAddr": "172.18.0.1", "user": "m", "app": "index", "method": "POST", "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start", "message": { "Exception": "UnexpectedValueException", "Message": "Only integers, floats and strings are allowed as value", "Code": 0, "Trace": [ { "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php", "line": 107, "function": "setUserValue", "class": "OC\\AllConfig", "type": "->", "args": [ "m", "twofactor_gateway", "telegram_chat_id", null ] }, { "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php", "line": 75, "function": "getChatId", "class": "OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway", "type": "->", "args": [ { "__class__": "OC\\User\\User" }, { "__class__": "Telegram\\Bot\\Api" }, 99999999 ] }, { "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Service\/SetupService.php", "line": 92, "function": "send", "class": "OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway", "type": "->", "args": [ { "__class__": "OC\\User\\User" }, "99999999", "666666 is your Nextcloud verification code." ] }, { "file": "\/config\/www\/nextcloud\/apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php", "line": 90, "function": "startSetup", "class": "OCA\\TwoFactorGateway\\Service\\SetupService", "type": "->", "args": [ { "__class__": "OC\\User\\User" }, "telegram", "99999999" ] }, { "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php", "line": 166, "function": "startVerification", "class": "OCA\\TwoFactorGateway\\Controller\\SettingsController", "type": "->", "args": [ "telegram", "99999999" ] }, { "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php", "line": 99, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OCA\\TwoFactorGateway\\Controller\\SettingsController" }, "startVerification" ] }, { "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/App.php", "line": 118, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->", "args": [ { "__class__": "OCA\\TwoFactorGateway\\Controller\\SettingsController" }, "startVerification" ] }, { "file": "\/config\/www\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php", "line": 47, "function": "main", "class": "OC\\AppFramework\\App", "type": "::", "args": [ "OCA\\TwoFactorGateway\\Controller\\SettingsController", "startVerification", { "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer" }, { "gateway": "telegram", "_route": "twofactor_gateway.settings.startVerification" } ] }, { "function": "__invoke", "class": "OC\\AppFramework\\Routing\\RouteActionHandler", "type": "->", "args": [ { "gateway": "telegram", "_route": "twofactor_gateway.settings.startVerification" } ] }, { "file": "\/config\/www\/nextcloud\/lib\/private\/Route\/Router.php", "line": 297, "function": "call_user_func", "args": [ { "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler" }, { "gateway": "telegram", "_route": "twofactor_gateway.settings.startVerification" } ] }, { "file": "\/config\/www\/nextcloud\/lib\/base.php", "line": 987, "function": "match", "class": "OC\\Route\\Router", "type": "->", "args": [ "\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start" ] }, { "file": "\/config\/www\/nextcloud\/index.php", "line": 42, "function": "handleRequest", "class": "OC", "type": "::", "args": [ ] } ], "File": "\/config\/www\/nextcloud\/lib\/private\/AllConfig.php", "Line": 214, "CustomMessage": "--" }, "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0", "version": "14.0.2.0" } ```
Author
Owner

@ChristophWurst commented on GitHub (Oct 6, 2018):

Did you actually set the log level to 0/debug?

<!-- gh-comment-id:427591249 --> @ChristophWurst commented on GitHub (Oct 6, 2018): Did you actually set the log level to 0/debug?
Author
Owner

@mmartinortiz commented on GitHub (Oct 7, 2018):

{
  "reqId": "Jg20asmA0bX4a6kiIFQZ",
  "level": 0,
  "time": "2018-10-07T09:12:17+00:00",
  "remoteAddr": "172.18.0.1",
  "user": "m",
  "app": "core",
  "method": "POST",
  "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start",
  "message": "Scss is disabled for \/config\/www\/nextcloud\/core\/css\/jquery-ui-fixes.scss, ignoring",
  "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0",
  "version": "14.0.2.0"
}
{
  "reqId": "Jg20asmA0bX4a6kiIFQZ",
  "level": 0,
  "time": "2018-10-07T09:12:17+00:00",
  "remoteAddr": "172.18.0.1",
  "user": "m",
  "app": "core",
  "method": "POST",
  "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start",
  "message": "Scss is disabled for \/config\/www\/nextcloud\/core\/css\/server.scss, ignoring",
  "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0",
  "version": "14.0.2.0"
}

The rest of the entries related to "Scss is disabled for...". I've also updated the log for my previous comment.

<!-- gh-comment-id:427638535 --> @mmartinortiz commented on GitHub (Oct 7, 2018): ```json { "reqId": "Jg20asmA0bX4a6kiIFQZ", "level": 0, "time": "2018-10-07T09:12:17+00:00", "remoteAddr": "172.18.0.1", "user": "m", "app": "core", "method": "POST", "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start", "message": "Scss is disabled for \/config\/www\/nextcloud\/core\/css\/jquery-ui-fixes.scss, ignoring", "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0", "version": "14.0.2.0" } { "reqId": "Jg20asmA0bX4a6kiIFQZ", "level": 0, "time": "2018-10-07T09:12:17+00:00", "remoteAddr": "172.18.0.1", "user": "m", "app": "core", "method": "POST", "url": "\/index.php\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start", "message": "Scss is disabled for \/config\/www\/nextcloud\/core\/css\/server.scss, ignoring", "userAgent": "Mozilla\/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko\/20100101 Firefox\/62.0", "version": "14.0.2.0" } ``` The rest of the entries related to `"Scss is disabled for..."`. I've also updated the log for my previous comment. ```
Author
Owner

@ChristophWurst commented on GitHub (Oct 7, 2018):

Again, please enable debug logging. The entry you provided just shows where the error happened, although there must be more log entries fore that. For reference, see https://github.com/nextcloud/twofactor_gateway/pull/126/files. There are numerous logging statements before $this->config->setUserValue is actually invoked.

Please see https://docs.nextcloud.com/server/14/admin_manual/configuration_server/logging_configuration.html and report back when you've got the debug logs.

<!-- gh-comment-id:427639057 --> @ChristophWurst commented on GitHub (Oct 7, 2018): Again, please enable debug logging. The entry you provided just shows where the error happened, although there *must* be more log entries fore that. For reference, see https://github.com/nextcloud/twofactor_gateway/pull/126/files. There are numerous logging statements before `$this->config->setUserValue` is actually invoked. Please see https://docs.nextcloud.com/server/14/admin_manual/configuration_server/logging_configuration.html and report back when you've got the debug logs.
Author
Owner

@ChristophWurst commented on GitHub (Oct 7, 2018):

Maybe I'm stating the obvious, but you have to reproduce the error in order to get the debug statements. Changing the log level post mortem won't magically recover them.

<!-- gh-comment-id:427639135 --> @ChristophWurst commented on GitHub (Oct 7, 2018): Maybe I'm stating the obvious, but you have to reproduce the error in order to get the debug statements. Changing the log level post mortem won't magically recover them.
Author
Owner

@mmartinortiz commented on GitHub (Oct 7, 2018):

For the sake of clarity, I'll list the steps I've followed for the logs provided:

  • Disable and remove twofactor_gateway from my Nextcloud server
  • Copy the earlier mentioned twofactor_gateway package manually to the apps folder
  • Enable the twofactor_gateway application
  • Set loglevel => 0 on config.php
  • Configure the twofactor_gateway application with my bot token from the command line
  • From my user settings->security, enable the Telegram gateway and introduce my Chat Id.
  • Copy the relevant lines from the nextcloud.log file

Since my server is used by several users, I see now that the debug lines got quickly lost.

In any case, here are the debug messages (directly from the web interface log)//:

Debug | no app in context | got 0 updates | 2018-10-07T18:32:32+0200
Debug | no app in context | trying to get chat id from updates | 2018-10-07T18:32:32+0200
Debug | no app in context | telegram bot token: <bot token> | 2018-10-07T18:32:32+0200
Debug | no app in context | sending telegram message to <chat id>, message: <auth code> is your Nextcloud verification code. | 2018-10-07T18:32:32+0200

I've used the logged <bot token> for accessing manually to the URL https://api.telegram.org/bot<bot_token>/getupdates for checking that it is correct.

<!-- gh-comment-id:427667881 --> @mmartinortiz commented on GitHub (Oct 7, 2018): For the sake of clarity, I'll list the steps I've followed for the logs provided: - Disable and remove `twofactor_gateway` from my Nextcloud server - Copy the earlier mentioned [twofactor_gateway](https://github.com/nextcloud/twofactor_gateway/pull/126) package manually to the `apps` folder - Enable the `twofactor_gateway` application - Set `loglevel => 0` on `config.php` - Configure the `twofactor_gateway` application with my bot token from the command line - From my user settings->security, `enable` the Telegram gateway and introduce my Chat Id. - Copy the relevant lines from the `nextcloud.log` file Since my server is used by several users, I see now that the debug lines got quickly lost. In any case, here are the debug messages (directly from the web interface log)//: ``` Debug | no app in context | got 0 updates | 2018-10-07T18:32:32+0200 Debug | no app in context | trying to get chat id from updates | 2018-10-07T18:32:32+0200 Debug | no app in context | telegram bot token: <bot token> | 2018-10-07T18:32:32+0200 Debug | no app in context | sending telegram message to <chat id>, message: <auth code> is your Nextcloud verification code. | 2018-10-07T18:32:32+0200 ``` I've used the logged `<bot token>` for accessing manually to the URL `https://api.telegram.org/bot<bot_token>/getupdates` for checking that it is correct.
Author
Owner

@ChristophWurst commented on GitHub (Oct 7, 2018):

Okay. So there are no updates available for the server. Did you (re)start the conversation with the bot as instructed on the provider settings page? The app can't map telegram users to Nextcloud users if they haven't started a chat recently.

<!-- gh-comment-id:427672227 --> @ChristophWurst commented on GitHub (Oct 7, 2018): Okay. So there are no updates available for the server. Did you (re)start the conversation with the bot as instructed on the provider settings page? The app can't map telegram users to Nextcloud users if they haven't started a chat recently.
Author
Owner

@mmartinortiz commented on GitHub (Oct 8, 2018):

Did you (re)start the conversation with the bot as instructed on the provider settings page?

The chat with the bot is currently receiving messages from other applications. What do you exactly mean with restart?. When I've used the same token and chat id for other applications, I never had to restart the conversation with the bot.

<!-- gh-comment-id:427796030 --> @mmartinortiz commented on GitHub (Oct 8, 2018): > Did you (re)start the conversation with the bot as instructed on the provider settings page? The chat with the bot is currently receiving messages from other applications. What do you exactly mean with restart?. When I've used the same token and chat id for other applications, I never had to restart the conversation with the bot.
Author
Owner

@ChristophWurst commented on GitHub (Oct 8, 2018):

Please elaborate how these other systems are set up. What do you enter so that the system knows which Telegram user/chat to send messages to?

I'm not a Telegram pro, in fact I haven only really used shortly to implement this feature. But from what I've researched on the topic there is no way for a bot to start the conversation with a user, so the user has to start it first. This first message will trigger an event which can be read by the telegram API. We use this event to map Nextcloud users to Telegram chats.

<!-- gh-comment-id:427796846 --> @ChristophWurst commented on GitHub (Oct 8, 2018): Please elaborate how these other systems are set up. What do you enter so that the system knows which Telegram user/chat to send messages to? I'm not a Telegram pro, in fact I haven only really used shortly to implement this feature. But from what I've researched on the topic there is no way for a bot to start the conversation with a user, so the user has to start it first. This first message will trigger an event which can be read by the telegram API. We use this event to map Nextcloud users to Telegram chats.
Author
Owner

@mmartinortiz commented on GitHub (Oct 9, 2018):

In few words, the mechanism to get the bot up and running is what you described:

  1. Create a bot with the Bot Father, save somewhere the Bot Token
  2. Start a conversation with your brand new bot
  3. Get your Chat id using the Get_id bot

From there, you can configure any program to make use of the Telegram API. The Bot Token and the Chat Id are the two things you need for receiving messages from your bot.

In my case, and previously to the Nextcloud 2FA, I configured my bot to be used by my server, that sends me messages about system updates, users, etc. I also configured the bot, with the same Bot Token and Chat Id in other docker containers for getting messages from the services they were running.

From the debug logs of the gateway, I see that the message is requested to be sent, but it never reach the Telegram API. Could it be that the API used by the gateway is not sending the message for some reason? can we increase the debug level of the API without introducing additional traces to see what is happening? (It has been decades since I programmed in PHP and things have changed a lot, I'm sorry if my questions are too evident)

<!-- gh-comment-id:428104478 --> @mmartinortiz commented on GitHub (Oct 9, 2018): In few words, the mechanism to get the bot up and running is what you described: 1. Create a bot with the Bot Father, save somewhere the Bot Token 2. Start a conversation with your brand new bot 3. Get your Chat id using the Get_id bot From there, you can configure any program to make use of the Telegram API. The Bot Token and the Chat Id are the two things you need for receiving messages from your bot. In my case, and previously to the Nextcloud 2FA, I configured my bot to be used by my server, that sends me messages about system updates, users, etc. I also configured the bot, with the same Bot Token and Chat Id in other docker containers for getting messages from the services they were running. From the debug logs of the gateway, I see that the message is requested to be sent, but it never reach the Telegram API. Could it be that the API used by the gateway is not sending the message for some reason? can we increase the debug level of the API without introducing additional traces to see what is happening? (It has been decades since I programmed in PHP and things have changed a lot, I'm sorry if my questions are too evident)
Author
Owner

@ChristophWurst commented on GitHub (Oct 9, 2018):

Please keep in mind that with this Nextcloud app, the admin knows and configures the bot, while users just have access to their Telegram account/ID. All they know is the bot ID.

From the debug logs of the gateway, I see that the message is requested to be sent, but it never reach the Telegram API.

What section of the code/process are you talking about? If the app fails to read the chat ID it obviously never sends out any Telegram message.

<!-- gh-comment-id:428106436 --> @ChristophWurst commented on GitHub (Oct 9, 2018): Please keep in mind that with this Nextcloud app, the admin knows and configures the bot, while users just have access to their Telegram account/ID. All they know is the bot ID. > From the debug logs of the gateway, I see that the message is requested to be sent, but it never reach the Telegram API. What section of the code/process are you talking about? If the app fails to read the chat ID it obviously never sends out any Telegram message.
Author
Owner

@mmartinortiz commented on GitHub (Oct 9, 2018):

Please keep in mind that with this Nextcloud app, the admin knows and configures the bot, while users just have access to their Telegram account/ID. All they know is the bot ID

That is something I wanted to ask. Since each user may have its own bot for authentification. Should not be the configuration (bot token and chat id) be done in the user's setting space?

What section of the code/process are you talking about? If the app fails to read the chat ID it obviously never sends out any Telegram message.

From the last debug line

Debug | no app in context | sending telegram message to <chat id>, message: <auth code> is your Nextcloud verification code. | 2018-10-07T18:32:32+0200

The chat id was correct, but my bot never received the message. The API is asked to send the message, but from the log we do not know if it really sends it.

<!-- gh-comment-id:428299359 --> @mmartinortiz commented on GitHub (Oct 9, 2018): > Please keep in mind that with this Nextcloud app, the admin knows and configures the bot, while users just have access to their Telegram account/ID. All they know is the bot ID That is something I wanted to ask. Since each user may have its own bot for authentification. Should not be the configuration (bot token and chat id) be done in the user's setting space? > What section of the code/process are you talking about? If the app fails to read the chat ID it obviously never sends out any Telegram message. From the last debug line ``` Debug | no app in context | sending telegram message to <chat id>, message: <auth code> is your Nextcloud verification code. | 2018-10-07T18:32:32+0200 ``` The chat id was correct, but my bot never received the message. The API is asked to send the message, but from the log we do not know if it really sends it.
Author
Owner

@ChristophWurst commented on GitHub (Oct 9, 2018):

That is something I wanted to ask. Since each user may have its own bot for authentification. Should not be the configuration (bot token and chat id) be done in the user's setting space?

No. There is one bot for all users.

<!-- gh-comment-id:428299948 --> @ChristophWurst commented on GitHub (Oct 9, 2018): > That is something I wanted to ask. Since each user may have its own bot for authentification. Should not be the configuration (bot token and chat id) be done in the user's setting space? No. There is *one bot* for *all users*.
Author
Owner

@ChristophWurst commented on GitHub (Oct 9, 2018):

How did you actually obtain the chat ID?

<!-- gh-comment-id:428301124 --> @ChristophWurst commented on GitHub (Oct 9, 2018): How did you actually obtain the *chat ID*?
Author
Owner

@Dretech commented on GitHub (Oct 9, 2018):

Should not be the configuration (bot token and chat id) be done in the user's setting space?

In my opinion the bot token is stored in the Nextcloud administrator setting space and the chad id in the user setting space. Because the administrator is the person who can activate the 2fa app.

<!-- gh-comment-id:428303960 --> @Dretech commented on GitHub (Oct 9, 2018): > Should not be the configuration (bot token and chat id) be done in the user's setting space? In my opinion the bot token is stored in the Nextcloud administrator setting space and the chad id in the user setting space. Because the administrator is the person who can activate the 2fa app.
Author
Owner

@mmartinortiz commented on GitHub (Oct 9, 2018):

Because the administrator is the person who can activate the 2fa app.

@Dretech, I agree, but the user is the person that decides to use it. A user can have already a specific bot for its personal use. But I understand that the administrator can set a bot as a "default bot"

No. There is one bot for all users.

@ChristophWurst, Can I ask for the technical reasons for that?

How did you actually obtain the chat ID?

Using the get id bot (as stated on the admin docs)

<!-- gh-comment-id:428314504 --> @mmartinortiz commented on GitHub (Oct 9, 2018): > Because the administrator is the person who can activate the 2fa app. @Dretech, I agree, but the user is the person that decides to use it. A user can have already a specific bot for its personal use. But I understand that the administrator can set a bot as a "default bot" > No. There is one bot for all users. @ChristophWurst, Can I ask for the technical reasons for that? > How did you actually obtain the chat ID? Using the [get id bot](https://telegram.me/get_id_bot) (as stated on the admin docs)
Author
Owner

@ChristophWurst commented on GitHub (Oct 10, 2018):

Using the get id bot (as stated on the admin docs)

That doesn't make sense to me.

Correct me if I'm wrong, but as far as I understood, every chat has it's own unique id. And so does every user. In order for a bot to send a message, it has to know the chat id of the conversation with the user. What the id bot tells you is your user ID. If it tells you a chat ID, that can only be the conversation with the id bot but now with your 2FA bot.

Now, this app asks you to start a conversation with your 2FA bot. It then asks you to enter your user ID obtained through the id bot. This app will then check for newly started conversations of the provided user ID. If a match is found, it can get the chat ID of the conversation between your user and the 2FA bot.

This is how the current setup logic works. If there were any way for a user to (easily) get the chat ID of the chat with the 2FA bot, we could have them enter that directly and skip the lookup step in the bot updates.

<!-- gh-comment-id:428452473 --> @ChristophWurst commented on GitHub (Oct 10, 2018): > Using the [get id bot](https://telegram.me/get_id_bot) (as stated on the admin docs) That doesn't make sense to me. Correct me if I'm wrong, but as far as I understood, every chat has it's own unique id. And so does every user. In order for a bot to send a message, it has to know the *chat id* of the conversation with the user. What the *id bot* tells you is your *user ID*. If it tells you a *chat ID*, that can only be the conversation with the *id bot* but now with your *2FA bot*. Now, this app asks you to start a conversation with your *2FA bot*. It then asks you to enter your *user ID* obtained through the *id bot*. This app will then check for newly started conversations of the provided *user ID*. If a match is found, it can get the *chat ID* of the conversation between your user and the *2FA bot*. This is how the current setup logic works. If there were any way for a user to (easily) get the chat ID of the chat with the *2FA bot*, we could have them enter that directly and skip the lookup step in the bot updates.
Author
Owner

@ChristophWurst commented on GitHub (Oct 10, 2018):

No. There is one bot for all users.

@ChristophWurst, Can I ask for the technical reasons for that?

There are no technical reasons/limitations. This app simply integrates Telegram in a way it is easy to set up and use for everyone. We must not assume that anybody can and wants to set up their own bot as that is a very technical procedure.

<!-- gh-comment-id:428452705 --> @ChristophWurst commented on GitHub (Oct 10, 2018): > > No. There is one bot for all users. > > @ChristophWurst, Can I ask for the technical reasons for that? There are no technical reasons/limitations. This app simply integrates Telegram in a way it is easy to set up and use for everyone. We must not assume that anybody can and wants to set up their own bot as that is a very technical procedure.
Author
Owner

@ChristophWurst commented on GitHub (Oct 10, 2018):

This is how the current setup logic works.

FYI: this is almost exactly what the official bot docs suggest, except that we don't rely on an initial shared secret: https://core.telegram.org/bots#deep-linking-example

Edit: also see https://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user.

<!-- gh-comment-id:428454560 --> @ChristophWurst commented on GitHub (Oct 10, 2018): > This is how the current setup logic works. FYI: this is almost exactly what the official bot docs suggest, except that we don't rely on an initial shared secret: https://core.telegram.org/bots#deep-linking-example Edit: also see https://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user.
Author
Owner

@Dretech commented on GitHub (Oct 10, 2018):

There are no technical reasons/limitations. This app simply integrates Telegram in a way it is easy to set up and use for everyone. We must not assume that anybody can and wants to set up their own bot as that is a very technical procedure.

I agree with this. Moreover the administrator has to install the 2fa app and in my opinion is setting up the Telegram bot part of the job for the administrator.

<!-- gh-comment-id:428671042 --> @Dretech commented on GitHub (Oct 10, 2018): > There are no technical reasons/limitations. This app simply integrates Telegram in a way it is easy to set up and use for everyone. We must not assume that anybody can and wants to set up their own bot as that is a very technical procedure. I agree with this. Moreover the administrator has to install the 2fa app and in my opinion is setting up the Telegram bot part of the job for the administrator.
Author
Owner

@Freekers commented on GitHub (Oct 15, 2018):

I am having the same issue. I'm also using my bot for other projects such as Domoticz or my own Python script, yet I was unable to get it to work with Nextcloud.

I am using the official Nextcloud docker 14.0.3-apache with the extra debugging version of the twofactor_gateway which can be found here: https://github.com/nextcloud/twofactor_gateway/pull/126

To setup and configure the app, I followed the exact same instructions as this guy, who got it working: https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=t&hl=nl&ie=UTF-8&u=https%3A%2F%2Fmatoken.org%2Fblog%2F2018%2F09%2F19%2Ftwo-factor-authentication-using-nextgram-14-telegram%2F%23_occ%25E3%2582%25B3%25E3%2583%259E%25E3%2583%25B3%25E3%2583%2589%25E3%2581%25A7_telegram_bot_%25E3%2581%25AE%25E3%2583%2588%25E3%2583%25BC%25E3%2582%25AF%25E3%2583%25B3%25E8%25A8%25AD%25E5%25AE%259A&edit-text=

The debug logging is big chunk of text, but apart from the 404 regarding the TelegramResponseException not found, there is not much from what I can see that goes wrong:

{"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"sending telegram message to CHATID_REMOVED_FOR_PRIVACY, message: 202382 is your Nextcloud verification code.","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"}

{"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"telegram bot token: BOTID_REMOVED_FOR_PRIVACY","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"}

{"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"trying to get chat id from updates","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"}

{"reqId":"zD816Eixo0of5jb4ddj5","level":3,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"index","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":{"Exception":"Telegram\\Bot\\Exceptions\\TelegramResponseException","Message":"Not Found","Code":404,"Trace":[{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":100,"function":"create","class":"Telegram\\Bot\\Exceptions\\TelegramResponseException","type":"::","args":[{"__class__":"Telegram\\Bot\\TelegramResponse"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":81,"function":"makeException","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":51,"function":"decodeBody","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":130,"function":"__construct","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":82,"function":"getResponse","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":304,"function":"sendRequest","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":181,"function":"sendRequest","class":"Telegram\\Bot\\Api","type":"->","args":["GET","getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Methods\/Update.php","line":47,"function":"get","class":"Telegram\\Bot\\Api","type":"->","args":["getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":94,"function":"getUpdates","class":"Telegram\\Bot\\Api","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":75,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},CHATID_REMOVED_FOR_PRIVACY]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"CHATID_REMOVED_FOR_PRIVACY","202382 is your Nextcloud verification code."]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Exceptions\/TelegramResponseException.php","Line":67,"Previous":{"Exception":"Telegram\\Bot\\Exceptions\\TelegramOtherException","Message":"Not Found","Code":404,"Trace":[{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":100,"function":"create","class":"Telegram\\Bot\\Exceptions\\TelegramResponseException","type":"::","args":[{"__class__":"Telegram\\Bot\\TelegramResponse"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":81,"function":"makeException","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":51,"function":"decodeBody","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":130,"function":"__construct","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":82,"function":"getResponse","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":304,"function":"sendRequest","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":181,"function":"sendRequest","class":"Telegram\\Bot\\Api","type":"->","args":["GET","getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Methods\/Update.php","line":47,"function":"get","class":"Telegram\\Bot\\Api","type":"->","args":["getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":94,"function":"getUpdates","class":"Telegram\\Bot\\Api","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":75,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},CHATID_REMOVED_FOR_PRIVACY]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"CHATID_REMOVED_FOR_PRIVACY","202382 is your Nextcloud verification code."]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Exceptions\/TelegramResponseException.php","Line":67},"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"}
{"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"core","method":"POST","url":"\/apps\/twofactor_gateway\

Kind regards.

<!-- gh-comment-id:429955454 --> @Freekers commented on GitHub (Oct 15, 2018): I am having the same issue. I'm also using my bot for other projects such as Domoticz or my own Python script, yet I was unable to get it to work with Nextcloud. I am using the official Nextcloud docker 14.0.3-apache with the extra debugging version of the twofactor_gateway which can be found here: https://github.com/nextcloud/twofactor_gateway/pull/126 To setup and configure the app, I followed the exact same instructions as this guy, who got it working: https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=nl&ie=UTF-8&u=https%3A%2F%2Fmatoken.org%2Fblog%2F2018%2F09%2F19%2Ftwo-factor-authentication-using-nextgram-14-telegram%2F%23_occ_%25E3%2582%25B3%25E3%2583%259E%25E3%2583%25B3%25E3%2583%2589%25E3%2581%25A7_telegram_bot_%25E3%2581%25AE%25E3%2583%2588%25E3%2583%25BC%25E3%2582%25AF%25E3%2583%25B3%25E8%25A8%25AD%25E5%25AE%259A&edit-text= The debug logging is big chunk of text, but apart from the 404 regarding the `TelegramResponseException` not found, there is not much from what I can see that goes wrong: ``` {"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"sending telegram message to CHATID_REMOVED_FOR_PRIVACY, message: 202382 is your Nextcloud verification code.","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"} {"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"telegram bot token: BOTID_REMOVED_FOR_PRIVACY","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"} {"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"no app in context","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":"trying to get chat id from updates","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"} {"reqId":"zD816Eixo0of5jb4ddj5","level":3,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"index","method":"POST","url":"\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start","message":{"Exception":"Telegram\\Bot\\Exceptions\\TelegramResponseException","Message":"Not Found","Code":404,"Trace":[{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":100,"function":"create","class":"Telegram\\Bot\\Exceptions\\TelegramResponseException","type":"::","args":[{"__class__":"Telegram\\Bot\\TelegramResponse"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":81,"function":"makeException","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":51,"function":"decodeBody","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":130,"function":"__construct","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":82,"function":"getResponse","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":304,"function":"sendRequest","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":181,"function":"sendRequest","class":"Telegram\\Bot\\Api","type":"->","args":["GET","getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Methods\/Update.php","line":47,"function":"get","class":"Telegram\\Bot\\Api","type":"->","args":["getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":94,"function":"getUpdates","class":"Telegram\\Bot\\Api","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":75,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},CHATID_REMOVED_FOR_PRIVACY]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"CHATID_REMOVED_FOR_PRIVACY","202382 is your Nextcloud verification code."]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Exceptions\/TelegramResponseException.php","Line":67,"Previous":{"Exception":"Telegram\\Bot\\Exceptions\\TelegramOtherException","Message":"Not Found","Code":404,"Trace":[{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":100,"function":"create","class":"Telegram\\Bot\\Exceptions\\TelegramResponseException","type":"::","args":[{"__class__":"Telegram\\Bot\\TelegramResponse"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":81,"function":"makeException","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramResponse.php","line":51,"function":"decodeBody","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":130,"function":"__construct","class":"Telegram\\Bot\\TelegramResponse","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/TelegramClient.php","line":82,"function":"getResponse","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"},{"__class__":"GuzzleHttp\\Psr7\\Response"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":304,"function":"sendRequest","class":"Telegram\\Bot\\TelegramClient","type":"->","args":[{"__class__":"Telegram\\Bot\\TelegramRequest"}]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Traits\/Http.php","line":181,"function":"sendRequest","class":"Telegram\\Bot\\Api","type":"->","args":["GET","getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Methods\/Update.php","line":47,"function":"get","class":"Telegram\\Bot\\Api","type":"->","args":["getUpdates",[]]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":94,"function":"getUpdates","class":"Telegram\\Bot\\Api","type":"->","args":[]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/Gateway\/Telegram\/Gateway.php","line":75,"function":"getChatId","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Telegram\\Bot\\Api"},CHATID_REMOVED_FOR_PRIVACY]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Service\/SetupService.php","line":92,"function":"send","class":"OCA\\TwoFactorGateway\\Service\\Gateway\\Telegram\\Gateway","type":"->","args":[{"__class__":"OC\\User\\User"},"CHATID_REMOVED_FOR_PRIVACY","202382 is your Nextcloud verification code."]},{"file":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/lib\/Controller\/SettingsController.php","line":90,"function":"startSetup","class":"OCA\\TwoFactorGateway\\Service\\SetupService","type":"->","args":[{"__class__":"OC\\User\\User"},"telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":166,"function":"startVerification","class":"OCA\\TwoFactorGateway\\Controller\\SettingsController","type":"->","args":["telegram","CHATID_REMOVED_FOR_PRIVACY"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":99,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/App.php","line":118,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\TwoFactorGateway\\Controller\\SettingsController"},"startVerification"]},{"file":"\/var\/www\/html\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php","line":47,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\TwoFactorGateway\\Controller\\SettingsController","startVerification",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"function":"__invoke","class":"OC\\AppFramework\\Routing\\RouteActionHandler","type":"->","args":[{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/private\/Route\/Router.php","line":297,"function":"call_user_func","args":[{"__class__":"OC\\AppFramework\\Routing\\RouteActionHandler"},{"gateway":"telegram","_route":"twofactor_gateway.settings.startVerification"}]},{"file":"\/var\/www\/html\/lib\/base.php","line":987,"function":"match","class":"OC\\Route\\Router","type":"->","args":["\/apps\/twofactor_gateway\/settings\/telegram\/verification\/start"]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/custom_apps\/twofactor_gateway\/vendor\/irazasyed\/telegram-bot-sdk\/src\/Exceptions\/TelegramResponseException.php","Line":67},"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko\/20100101 Firefox\/62.0","version":"14.0.3.0"} {"reqId":"zD816Eixo0of5jb4ddj5","level":0,"time":"2018-10-15T17:47:14+00:00","remoteAddr":"12.34.56.78","user":"freek","app":"core","method":"POST","url":"\/apps\/twofactor_gateway\ ``` Kind regards.
Author
Owner

@ChristophWurst commented on GitHub (Oct 15, 2018):

Please see https://github.com/nextcloud/twofactor_gateway/issues/110#issuecomment-428452473 and tell me if you're on the same page with what is a Telegram user ID and a Telegram chat ID. I have the feeling this is being used interchangeably while there's a huge difference.

sending telegram message to CHATID_REMOVED_FOR_PRIVACY

Here, for example. You should see the USER_ID and not chat id. This part confuses me.

<!-- gh-comment-id:429959527 --> @ChristophWurst commented on GitHub (Oct 15, 2018): Please see https://github.com/nextcloud/twofactor_gateway/issues/110#issuecomment-428452473 and tell me if you're on the same page with what is a *Telegram user ID* and a *Telegram chat ID*. I have the feeling this is being used interchangeably while there's a huge difference. > sending telegram message to CHATID_REMOVED_FOR_PRIVACY Here, for example. You should see the *USER_ID* and not chat id. This part confuses me.
Author
Owner

@Freekers commented on GitHub (Oct 15, 2018):

Telegram User ID: The ID returned by https://t.me/my_id_bot which in my case was the 'CHATID_REMOVED_FOR_PRIVACY' so it should be correct, right?

Telegram Chat ID: The ID of the chat with your bot, which can be obtained by forwarding a message received from your bot to https://telegram.me/get_id_bot .

I am using the same instructions as this guy, who also used the Telegram User ID

<!-- gh-comment-id:429969155 --> @Freekers commented on GitHub (Oct 15, 2018): Telegram User ID: The ID returned by https://t.me/my_id_bot which in my case was the 'CHATID_REMOVED_FOR_PRIVACY' so it should be correct, right? Telegram Chat ID: The ID of the chat with your bot, which can be obtained by forwarding a message received from your bot to https://telegram.me/get_id_bot . I am using the same instructions as [this guy,](https://translate.google.com/translate?sl=auto&tl=en&js=y&prev=_t&hl=nl&ie=UTF-8&u=https%3A%2F%2Fmatoken.org%2Fblog%2F2018%2F09%2F19%2Ftwo-factor-authentication-using-nextgram-14-telegram%2F%23_occ_%25E3%2582%25B3%25E3%2583%259E%25E3%2583%25B3%25E3%2583%2589%25E3%2581%25A7_telegram_bot_%25E3%2581%25AE%25E3%2583%2588%25E3%2583%25BC%25E3%2582%25AF%25E3%2583%25B3%25E8%25A8%25AD%25E5%25AE%259A&edit-text=) who also used the Telegram User ID
Author
Owner

@mmartinortiz commented on GitHub (Oct 16, 2018):

I've been gathering some definitions about the different terms we are using in this thread, so all we can be in the same line:

  • Bot token: The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API. Source
  • Personal/User Id: The id that identifies a user. This bot provides your user id. (I do not have a reference for this definition)
  • Chat Id: The id that identifies a chat/group. From reddit: Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you.

With the services/applications I am running, I use the bot token as 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw. As chat id on those services/applications, I'm using my user id because in my case it is a private conversation with my bot (as mentioned in Reddit)

I've tried using the complete token, as well as only the part after the semicolon together with my user id (as equivalent to chat id, because it is a private conversation).

In every case, the debug log obtained with the twofactor_gateway version with extended debug support (obtained here](https://github.com/nextcloud/twofactor_gateway/pull/126)) does not differ from my previous logs.

<!-- gh-comment-id:430174531 --> @mmartinortiz commented on GitHub (Oct 16, 2018): I've been gathering some definitions about the different terms we are using in this thread, so all we can be in the same line: - **Bot token**: The token is a string along the lines of `110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw` that is required to authorize the bot and send requests to the Bot API. [Source](https://core.telegram.org/bots#6-botfather) - **Personal/User Id**: The id that identifies a user. [This bot](https://t.me/my_id_bot) provides your user id. (I do not have a reference for this definition) - **Chat Id**: The id that identifies a chat/group. [From reddit](https://www.reddit.com/r/Telegram/comments/7dj46l/chat_id/dpy7tz2): *Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you.* With the services/applications I am running, I use the **bot token** as `110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw`. As **chat id** on those services/applications, I'm using my **user id** because in my case it is a private conversation with my bot (as mentioned in Reddit) I've tried using the complete token, as well as only the part after the semicolon together with my user id (as equivalent to chat id, because it is a private conversation). In every case, the debug log obtained with the *twofactor_gateway* version with extended debug support (obtained here](https://github.com/nextcloud/twofactor_gateway/pull/126)) does not differ from my previous logs.
Author
Owner

@ChristophWurst commented on GitHub (Oct 16, 2018):

@mmartinortiz thanks a lot for trying to make this finally clear for everyone 😉

  • Personal/User Id: The id that identifies a user. This bot provides your user id. (I do not have a reference for this definition)

  • Chat Id: The id that identifies a chat/group. From reddit: Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you.

This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all.

<!-- gh-comment-id:430293978 --> @ChristophWurst commented on GitHub (Oct 16, 2018): @mmartinortiz thanks a lot for trying to make this finally clear for everyone :wink: > * **Personal/User Id**: The id that identifies a user. [This bot](https://t.me/my_id_bot) provides your user id. (I do not have a reference for this definition) > > * **Chat Id**: The id that identifies a chat/group. [From reddit](https://www.reddit.com/r/Telegram/comments/7dj46l/chat_id/dpy7tz2): _Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you._ This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all.
Author
Owner

@Dretech commented on GitHub (Oct 16, 2018):

Doesn't that say that the user ID and chat ID are the same

In the test script below the user id is the id of the user which is displayed by using the get id bot. I hope this will help to define what the user id is.

?php

$userid="123456789"; # the user id you got by using the get id bot
$key="123456789:CCE8xLJa_sXsj6kxeWaLwxyJ9M368klTnlS"; # the token of the bot you created for using 2fa with nextcloud
$timeout="10";
$text="Test message";

$url="https://api.telegram.org/bot$key/sendMessage?chat_id=$userid&disable_web_page_preview=1&text=$text";

$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);

?>
<!-- gh-comment-id:430363525 --> @Dretech commented on GitHub (Oct 16, 2018): > Doesn't that say that the user ID and chat ID are the same In the test script below the user id is the id of the user which is displayed by using the get id bot. I hope this will help to define what the user id is. ``` ?php $userid="123456789"; # the user id you got by using the get id bot $key="123456789:CCE8xLJa_sXsj6kxeWaLwxyJ9M368klTnlS"; # the token of the bot you created for using 2fa with nextcloud $timeout="10"; $text="Test message"; $url="https://api.telegram.org/bot$key/sendMessage?chat_id=$userid&disable_web_page_preview=1&text=$text"; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_exec($ch); curl_close($ch); ?> ```
Author
Owner

@Freekers commented on GitHub (Oct 17, 2018):

@mmartinortiz thanks a lot for trying to make this finally clear for everyone 😉

  • Personal/User Id: The id that identifies a user. This bot provides your user id. (I do not have a reference for this definition)
  • Chat Id: The id that identifies a chat/group. From reddit: Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you.

This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all.

The @my_id_bot has multiple functionalities. It can tell you your Personal/User ID but also the Chat ID of your groupschat.
The @get_id_bot also has multiple functionalities. Next to telling you your Personal/User ID it can also tell you the Chat ID of any chat, not just a groupschat.

Example:
afbeelding

<!-- gh-comment-id:430775207 --> @Freekers commented on GitHub (Oct 17, 2018): > > > @mmartinortiz thanks a lot for trying to make this finally clear for everyone 😉 > > > * **Personal/User Id**: The id that identifies a user. [This bot](https://t.me/my_id_bot) provides your user id. (I do not have a reference for this definition) > > * **Chat Id**: The id that identifies a chat/group. [From reddit](https://www.reddit.com/r/Telegram/comments/7dj46l/chat_id/dpy7tz2): _Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you._ > > This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all. The @my_id_bot has multiple functionalities. It can tell you your Personal/User ID but also the Chat ID of your groupschat. The @get_id_bot also has multiple functionalities. Next to telling you your Personal/User ID it can also tell you the Chat ID of *any* chat, not just a groupschat. Example: ![afbeelding](https://user-images.githubusercontent.com/1370857/47114160-52ee3580-d25b-11e8-8f09-c0c27970385e.png)
Author
Owner

@mmartinortiz commented on GitHub (Oct 22, 2018):

@mmartinortiz thanks a lot for trying to make this finally clear for everyone wink

  • Personal/User Id: The id that identifies a user. This bot provides your user id. (I do not have a reference for this definition)
  • Chat Id: The id that identifies a chat/group. From reddit: Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you.

This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all.

Exactly, if you are in a private conversation with your bot, then the chat id is the same that the user id.

@ChristophWurst , how can we help to debug further this issue?

<!-- gh-comment-id:431934178 --> @mmartinortiz commented on GitHub (Oct 22, 2018): > @mmartinortiz thanks a lot for trying to make this finally clear for everyone wink > > > * **Personal/User Id**: The id that identifies a user. [This bot](https://t.me/my_id_bot) provides your user id. (I do not have a reference for this definition) > > * **Chat Id**: The id that identifies a chat/group. [From reddit](https://www.reddit.com/r/Telegram/comments/7dj46l/chat_id/dpy7tz2): _Chat ID is your personal ID if you're in private chat (dialogue) with bot and Group/Channel id otherwise. If you want to know personal ID, simply go to chat with @my_id_bot and it will tell you._ > > This part confuses me. Doesn't that say that the user ID and chat ID are the same, at least for personal chats? It's the very same bot that tells you the ID after all. Exactly, if you are in a private conversation with your bot, then the chat id is the same that the user id. @ChristophWurst , how can we help to debug further this issue?
Author
Owner

@ChristophWurst commented on GitHub (Oct 23, 2018):

Exactly, if you are in a private conversation with your bot, then the chat id is the same that the user id.

Perfect! This means we can simplify the setup process a lot. I will try to change this soon.

<!-- gh-comment-id:432101653 --> @ChristophWurst commented on GitHub (Oct 23, 2018): > Exactly, if you are in a private conversation with your bot, then the chat id is the same that the user id. Perfect! This means we can simplify the setup process a lot. I will try to change this soon.
Author
Owner

@Dretech commented on GitHub (Mar 12, 2019):

Unfortunately my Telegram ID I entered in the text box, gives the message "Could not verify your code. Please try again." I also tried my phone number, but I get the same error message.

<!-- gh-comment-id:471973956 --> @Dretech commented on GitHub (Mar 12, 2019): Unfortunately my Telegram ID I entered in the text box, gives the message "Could not verify your code. Please try again." I also tried my phone number, but I get the same error message.
Author
Owner

@parreitu commented on GitHub (Apr 26, 2019):

Hi, check out this: https://github.com/nextcloud/twofactor_gateway/issues/226#issuecomment-487092287

<!-- gh-comment-id:487095464 --> @parreitu commented on GitHub (Apr 26, 2019): Hi, check out this: [https://github.com/nextcloud/twofactor_gateway/issues/226#issuecomment-487092287](https://github.com/nextcloud/twofactor_gateway/issues/226#issuecomment-487092287)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/twofactor_gateway-nextcloud#36
No description provided.