Closed mlemerre closed 3 years ago
can you run with --debug
?
Do you see "... with cookie (MMAUTH) token ..." somewhere?
Here is the debug log when I tried to write something
DEBU[2021-01-14T01:17:37+01:00] B: "<- PRIVMSG name :b"
module=matterircd
DEBU[2021-01-14T01:17:37+01:00] flushing buffer:
&irc.Message{Prefix:(irc.Prefix)(nil), Command:"PRIVMSG",
Params:[]string{"name"}, Trailing:"b", EmptyTrailing:false}
module=matterircd
DEBU[2021-01-14T01:17:37+01:00] Executed
&irc.Message{Prefix:(irc.Prefix)(nil), Command:"PRIVMSG",
Params:[]string{"name"}, Trailing:"b", EmptyTrailing:false}
I don't have such a setup so I can't test this myself, but it's strange that login succeeds and then the other stuff fails.
Can you ask the admin if they see something about this in the mattermost server logs?
Yes, I asked and he told me that he had 10 times this:
"2001:861:4284:e290:b7e4:96:9e1c:e771 - - [15/Jan/2021:00:03:25 +0100] "POST /api/v4/channels/members/9u5kx3nb8fn3umiotqjzdf7k7o/view HTTP/1.1" 401 186 "" "Go-http-client/1.1" -" 401 => "No access token provided"
It seems to me that matterircd tries to send a regular token instead of an MMAUTH token when sending data, or something like this
On Thu, Jan 14, 2021 at 11:22 PM Wim notifications@github.com wrote:
I don't have such a setup so I can't test this myself, but it's strange that login succeeds and then the other stuff fails.
Can you ask the admin if they see something about this in the mattermost server logs?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/42wim/matterircd/issues/370#issuecomment-760513012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATOY3XPX3LXRVLIEHTH6XTSZ5VA7ANCNFSM4V7JRH6Q .
My administrator gave me a personal token which solves the problem for me, but the problem remains.
@mlemerre so after you see all those "invalid or expired session" errors, can you log into the Mattermost web UI and type something? Does it come through to matterircd?
I'm just wonder if it's just that the session token has expired. Could probably reproduce this with:
curl -i -d '{"login_id":"someone@nowhere.com","password":"thisisabadpassword"}' http://localhost:8065/api/v4/users/login
Then grabbing the provided Token
and using that with matterircd to connect.
I am having the same issue. I can receive messages that i type into the web client, but cannot send messages via matterircd. Here is a debug log. The message "this is a test" goes from browser client to matterircd and succeeds. The message "but i can't reply" fails to go from matterircd to the web client.
[2021-06-23T10:46:26+01:00] DEBUG matterclient: WsReceiver event: &model.WebSocketEvent{Event:"posted", Data:map[string]interface {}{"channel_display_name":"Off-Topic", "channel_name":"off-topic", "channel_type":"O", "post":"{\"id\":\"<id>\",\"create_at\":1624441586911,\"update_at\":1624441586911,\"edit_at\":0,\"delete_at\":0,\"is_pinned\":false,\"user_id\":\"<userid>\",\"channel_id\":\"<channelid>\",\"root_id\":\"\",\"parent_id\":\"\",\"original_id\":\"\",\"message\":\"This is a test :)\",\"type\":\"\",\"props\":{\"disable_group_highlight\":true},\"hashtags\":\"\",\"pending_post_id\":\"i3dfkdnju7rkjc94hr4ipdhqtc:1624441586749\",\"reply_count\":0,\"last_reply_at\":0,\"participants\":null,\"metadata\":{}}", "sender_name":"@<username>", "set_online":true, "team_id":"<team>"}, Broadcast:(*model.WebsocketBroadcast)(0xc000264740), Sequence:4, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[2021-06-23T10:46:26+01:00] MMUser WsReceiver: &model.WebSocketEvent{Event:"posted", Data:map[string]interface {}{"channel_display_name":"Off-Topic", "channel_name":"off-topic", "channel_type":"O", "post":"{\"id\":\"<id>\",\"create_at\":1624441586911,\"update_at\":1624441586911,\"edit_at\":0,\"delete_at\":0,\"is_pinned\":false,\"user_id\":\"<userid>\",\"channel_id\":\"<channelid>\",\"root_id\":\"\",\"parent_id\":\"\",\"original_id\":\"\",\"message\":\"This is a test :)\",\"type\":\"\",\"props\":{\"disable_group_highlight\":true},\"hashtags\":\"\",\"pending_post_id\":\"<id>:1624441586749\",\"reply_count\":0,\"last_reply_at\":0,\"participants\":null,\"metadata\":{}}", "sender_name":"@<username>", "set_online":true, "team_id":"<teamid>"}, Broadcast:(*model.WebsocketBroadcast)(0xc000264740), Sequence:4, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[2021-06-23T10:46:26+01:00] handleWsActionPost() receiving userid <userid>
DEBU[2021-06-23T10:46:26+01:00] handleWsActionPost() user <userid> sent This is a test :)
DEBU[2021-06-23T10:46:26+01:00] &model.Post{Id:"<id>", CreateAt:1624441586911, UpdateAt:1624441586911, EditAt:0, DeleteAt:0, IsPinned:false, UserId:"<userid>", ChannelId:"<channelid>", RootId:"", ParentId:"", OriginalId:"", Message:"This is a test :)", MessageSource:"", Type:"", propsMu:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, Props:model.StringInterface{"disable_group_highlight":true}, Hashtags:"", Filenames:model.StringArray(nil), FileIds:model.StringArray(nil), PendingPostId:"<id>:1624441586749", HasReactions:false, ReplyCount:0, Metadata:(*model.PostMetadata)(0xc000176e00)}
DEBU[2021-06-23T10:46:26+01:00] in handleWsMessage0
DEBU[2021-06-23T10:46:26+01:00] in handleChannelMessageEvent module=matterircd
DEBU[2021-06-23T10:46:26+01:00] -> :matt!matt@matt PRIVMSG #off-topic :This is a test :) module=matterircd
[2021-06-23T10:46:26+01:00] DEBUG matterclient: WsReceiver event: &model.WebSocketEvent{Event:"channel_viewed", Data:map[string]interface {}{"channel_id":"<channelid>"}, Broadcast:(*model.WebsocketBroadcast)(0xc00054a340), Sequence:5, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[2021-06-23T10:46:26+01:00] MMUser WsReceiver: &model.WebSocketEvent{Event:"channel_viewed", Data:map[string]interface {}{"channel_id":"<channelid>"}, Broadcast:(*model.WebsocketBroadcast)(0xc00054a340), Sequence:5, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[2021-06-23T10:46:27+01:00] in handleWsMessage0
[2021-06-23T10:46:29+01:00] DEBUG matterclient: posting lastview "<idthing>"
[2021-06-23T10:46:29+01:00] ERROR matterclient: ChannelView update for <idthing> failed: : Invalid or expired session, please login again.,
ERRO[2021-06-23T10:46:29+01:00] updateLastViewed failed: : Invalid or expired session, please login again.,
DEBU[2021-06-23T10:46:47+01:00] B: "<- PRIVMSG #off-topic :But i can't reply" module=matterircd
DEBU[2021-06-23T10:46:47+01:00] flushing buffer: &irc.Message{Prefix:(*irc.Prefix)(nil), Command:"PRIVMSG", Params:[]string{"#off-topic"}, Trailing:"But i can't reply", EmptyTrailing:false} module=matterircd
DEBU[2021-06-23T10:46:47+01:00] -> :matt!matt@localhost PRIVMSG mattermost :msg: But i can't reply could not be send: : Invalid or expired session, please login again., module=matterircd
DEBU[2021-06-23T10:46:47+01:00] Executed &irc.Message{Prefix:(*irc.Prefix)(nil), Command:"PRIVMSG", Params:[]string{"#off-topic"}, Trailing:"But i can't reply", EmptyTrailing:false} &model.AppError{Id:"api.context.session_expired.app_error", Message:"Invalid or expired session, please login again.", DetailedError:"", RequestId:"<id>", StatusCode:401, Where:"", IsOAuth:false, params:map[string]interface {}(nil)} module=matterircd
ERRO[2021-06-23T10:46:47+01:00] handler error for <id>: : Invalid or expired session, please login again., module=matterircd
[2021-06-23T10:46:47+01:00] DEBUG matterclient: WsReceiver response: &model.WebSocketResponse{Status:"OK", SeqReply:6, Data:map[string]interface {}{"node_id":"", "server_time":1.624441607866e+12, "text":"pong", "version":"5.34.0"}, Error:(*model.AppError)(nil)}
[2021-06-23T10:46:47+01:00] DEBUG matterclient: getting response: &model.WebSocketResponse{Status:"OK", SeqReply:6, Data:map[string]interface {}{"node_id":"", "server_time":1.624441607866e+12, "text":"pong", "version":"5.34.0"}, Error:(*model.AppError)(nil)}
[2021-06-23T10:46:48+01:00] DEBUG matterclient: WsReceiver event: &model.WebSocketEvent{Event:"channel_viewed", Data:map[string]interface {}{"channel_id":"frf8rkpxutn83yjd7jwahh6ifh"}, Broadcast:(*model.WebsocketBroadcast)(0xc000264300), Sequence:6, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
DEBU[2021-06-23T10:46:48+01:00] MMUser WsReceiver: &model.WebSocketEvent{Event:"channel_viewed", Data:map[string]interface {}{"channel_id":"<channeid>"}, Broadcast:(*model.WebsocketBroadcast)(0xc000264300), Sequence:6, precomputedJSON:(*model.precomputedWebSocketEventJSON)(nil)}
This is with version 0.22.0. It persists in 0.24.2 (5.34.0.5.34.2.9a2e430a5e80e46c9702deb3baeef177.true).
Ok, i fixed this for me. I was logging in with
/msg mattermost server team user MMAUTHTOKEN=<my mmauthtoken from cookies>
changing that to
/msg mattermost server team user token=<my mmauthtoken from cookies>
seems to have solved it.
I'm going to close this now then :)
The documentation on this could do with a quick update though (it says to use MMAUTHTOKEN): https://github.com/42wim/matterircd#mattermost-login-with-ssogitlab
@yourealwaysbe well it should be MMAUTHTOKEN, when using the token option you're using a "personal access token". I can add it as an extra "if it doesn't work try token="
Hi,
I use matterircd to connect to a mattermost instance, and while I can receive the messages just fine, sending them does no appear to work.
Specifically, I am using:
Thanks for matterircd!
Matthieu