Custom auth is not make request to loginProvider

34 views
Skip to first unread message

Trần Văn Kiên

unread,
Aug 24, 2023, 7:37:05 AMAug 24
to Tinode General
My custom auth config as below, but it's not working.
Seem that It do not make request to loginProvider. (I have already curl -X POST manual, the network is ok).
"auth_config": {            
                "logical_names": ["myAuth:basic", "basic:"],
                "myAuth": {
                        "server_url": "http://172.17.0.1:8000/api/user/",
                        "allow_new_accounts": true,
                        "use_separate_endpoints": true
                },
                "basic": {          
                        "add_to_tags": true,
                        "min_login_length": 3,
                        "min_password_length": 6
                },          
                "token": {    
                        "expire_in": 1209600,          
                        "serial_num": 1,
                        "key": "wfaY2RgF2S1OQI/ZlK+LSrp1KB2jwAdGAIHQ7JZn+Kc="
                }                                  
        },

My tinode logs:
2023/08/24 11:32:20 in: '{"login":{"scheme":"token","secret":"ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqWXpPREJsWmpFeVpqazFaamt4Tm1OaFpEZGhOR05sTXpnNFpESmpNbU16WXpJek1ESm1aR1VpTENKMGVYQWlPaUpLVjFRaWZRLmV5SnVZVzFsSWpvaVNHRjFJRlJ5WVc0aUxDSndhV04wZFhKbElqb2lhSFIwY0hNNkx5OXNhRE11WjI5dloyeGxkWE5sY21OdmJuUmxiblF1WTI5dEwyRXRMMEZQYURFMFIybDJaRmN0ZEcwelJIVldWRzAzUW1Gd04yMHlZVXBoVkZoRGVEZDRibXhaV0dkeE5tNXZha0U5Y3prMkxXTWlMQ0pwYzNNaU9pSm9kSFJ3Y3pvdkwzTmxZM1Z5WlhSdmEyVnVMbWR2YjJkc1pTNWpiMjB2WVhCd1kyOXlaUzFtT1dJMk1DSXNJbUYxWkNJNkltRndjR052Y21VdFp<...>' sid='Vqfngpa3KNs' uid='''

Thanks in advance.

Trần Văn Kiên

unread,
Aug 24, 2023, 7:39:36 AMAug 24
to Tinode General
One more log:

W2023/08/24 11:33:55 s.dispatch json: cannot unmarshal object into Go struct field MsgClientLogin.login.cred of type []main.MsgCredClient ZZAebyLr94I
I2023/08/24 11:36:21 ws: session started tjnFuRrshUY 117.4.246.227:47005 1
I2023/08/24 11:36:22 in: '{"hi":{"ua":"FreeTalk (Dart; android); tinode-dart/1.0.0-alpha.2","ver":"1.0.0-alpha.2","dev":"","lang":"en-US","platf":"Android","id":"116528"}}' sid='tjnFuRrshUY' uid=''
I2023/08/24 11:36:24 in: '{"login":{"scheme":"token","secret":"ZXlKaGJHY2lPaUpTVXpJMU5pSXNJbXRwWkNJNklqWXpPREJsWmpFeVpqazFaamt4Tm1OaFpEZGhOR05sTXpnNFpESmpNbU16WXpJek1ESm1aR1VpTENKMGVYQWlPaUpLVjFRaWZRLmV5SnVZVzFsSWpvaVNHRjFJRlJ5WVc0aUxDSndhV04wZFhKbElqb2lhSFIwY0hNNkx5OXNhRE11WjI5dloyeGxkWE5sY21OdmJuUmxiblF1WTI5dEwyRXRMMEZQYURFMFIybDJaRmN0ZEcwelJIVldWRzAzUW1Gd04yMHlZVXBoVkZoRGVEZDRibXhaV0dkeE5tNXZha0U5Y3prMkxXTWlMQ0pwYzNNaU9pSm9kSFJ3Y3pvdkwzTmxZM1Z5WlhSdmEyVnVMbWR2YjJkc1pTNWpiMjB2WVhCd1kyOXlaUzFtT1dJMk1DSXNJbUYxWkNJNkltRndjR052Y21VdFp<...>' sid='tjnFuRrshUY' uid=''

Gene

unread,
Aug 24, 2023, 7:54:16 AMAug 24
to Tinode General
I don't see relevant errors in your logs. The [W2023/08/24 11:33:55 s.dispatch json: cannot unmarshal object] is from a prior session. You configured your "myAuth" to be addressable as "basic" but you are not using "basic", you are using "token". Why do you think it's not working?

Please show the logs from your auth provider and maybe your client logs using "basic" auth scheme.

Trần Văn Kiên

unread,
Aug 24, 2023, 9:39:40 AMAug 24
to Tinode General

I'm using login by token from firebase:
I see that it only start tinode docker with config: "logical_names": ["myAuth:basic", "basic:"],
Don't have any log from my auth provider when I login by token (flutter sdk show 401 on debug mode).

Gene

unread,
Aug 24, 2023, 9:53:57 AMAug 24
to Tinode General
On Thursday, August 24, 2023 at 4:39:40 PM UTC+3 Trần Văn Kiên wrote:

I'm using login by token from firebase:
I see that it only start tinode docker with config: "logical_names": ["myAuth:basic", "basic:"],

This config tells Tinode server to call "myAuth" auth handler when it sees an attempt to log in with "scheme": "basic".
  
Don't have any log from my auth provider when I login by token (flutter sdk show 401 on debug mode).

That is exactly how it should behave because "token" is configured to be Tinode's internal handler.

Gene

unread,
Aug 24, 2023, 10:26:44 AMAug 24
to Tinode General
On Thursday, August 24, 2023 at 4:53:57 PM UTC+3 Gene wrote:
On Thursday, August 24, 2023 at 4:39:40 PM UTC+3 Trần Văn Kiên wrote:

I'm using login by token from firebase:
I see that it only start tinode docker with config: "logical_names": ["myAuth:basic", "basic:"],

This config tells Tinode server to call "myAuth" auth handler when it sees an attempt to log in with "scheme": "basic".

Actually, this config tells Tinode to call built-in "basic" when you attempt to login as "scheme": "myAuth". I'm pretty sure it's not what you want.

Trần Văn Kiên

unread,
Aug 25, 2023, 12:27:03 AMAug 25
to Tinode General
Thank you for reply me.

At our flutter sdk, we try with "scheme": "myAuth", and it's still not working.
And the same with "scheme": "basic" with base64_encode & utf8 encode token.

Could you suggest me about config on the tinode server: "logical_names": ["myAuth:basic", "basic:"]
And how to use it on flutter sdk (basic, token, myAuth, ..)

Gene

unread,
Aug 25, 2023, 1:25:48 AMAug 25
to Tinode General
On Friday, August 25, 2023 at 7:27:03 AM UTC+3 Trần Văn Kiên wrote:
Thank you for reply me.

At our flutter sdk, we try with "scheme": "myAuth", and it's still not working.

 What is "myAuth"? did you write your own authorizer and compiled it into the server?

And the same with "scheme": "basic" with base64_encode & utf8 encode token.

Built-in "basic" expects secret to be base64-encoded "login:password" string. If you are sending some other secret it's not going to work.

Could you suggest me about config on the tinode server: "logical_names": ["myAuth:basic", "basic:"]

 This config tells Tinode to call built-in "basic" when you attempt to login as "scheme": "myAuth". See my comment above.

And how to use it on flutter sdk (basic, token, myAuth, ..)

That depends on what you want to achieve and how.

Trần Văn Kiên

unread,
Oct 18, 2023, 11:27:53 PMOct 18
to Tinode General
It's working now with below config, thank you!.

        "auth_config": {
               "logical_names": ["basic:rest", "rest:"],
                "rest": {
                        "server_url": "http://example/api/user/",

                        "allow_new_accounts": true,
                        "use_separate_endpoints": true
                },
                "basic": {
                        "add_to_tags": true,
                        "min_login_length": 3,
                        "min_password_length": 6
                },
                "token": {
                        "expire_in": 1209600,
                        "serial_num": 1,
                        "key": "$AUTH_TOKEN_KEY"
                }
        },
Reply all
Reply to author
Forward
0 new messages