poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
954 stars 119 forks source link

cannot login with username/password it always redirects to SSO #311

Open jasom opened 2 years ago

jasom commented 2 years ago

I'm not using SSO, I can login with other matrix clients without SSO. However when I try with weechat-matrix it requests SSO:

               │17:11:04 matrix_org  -- | matrix: disconnected from server
               │17:11:07 matrix_org  -- | matrix: Connecting to matrix.org:443 (SSL)...
               │17:11:07 matrix_org  -- | matrix: Doing SSL handshake...
               │17:11:07 matrix_org  -- | matrix: Connected using TLSv1.3, and 256 bit TLS_AES_256_GCM_SHA384 cipher suite.
               │17:11:07 matrix_org  -- | matrix: received certificate
               │17:11:07 matrix_org     |  - certificate info:
               │17:11:07 matrix_org     |     - subject: commonName=www.matrix.org, serial number
               │17:11:07 matrix_org     |         03E8B9458F2389C0A18235C4E835C53446D8
               │17:11:07 matrix_org     |     - issuer: countryName=US, organizationName=Let's Encrypt,
               │17:11:07 matrix_org     |         commonName=R3
               │17:11:07 matrix_org     |     - key info: RSA key 4096 bits, signed using
               │17:11:07 matrix_org     |         sha256WithRSAEncryption
               │17:11:07 matrix_org     |     - period of validity:
               │17:11:07 matrix_org     |         Begins on:  Nov 24 08:30:32 2021 GMT
               │17:11:07 matrix_org     |         Expires on: Feb 22 08:30:31 2022 GMT
               │17:11:07 matrix_org     |     - fingerprints:
               │17:11:07 matrix_org     |         SHA1:   74:56:73:45:6D:8A:C2:15:0B:34:8C:A7:CB:68:7F:15:C2:1D:20:D8
               │17:11:07 matrix_org     |         SHA256: 9C:9B:9C:2B:89:70:72:CE:B4:34:76:B0:18:66:54:90:B7:4C:51:D6:7D:DB:BC:7D:76:34:EF:86:90:F1:FF:2A
               │17:11:08 matrix_org  -- | matrix: The server requested a single sign-on, please open this URL in your browser. Note that the browser needs to run on the same host as Weechat.
               │17:11:08 matrix_org  -- | matrix: https://matrix.org:443/_matrix/client/r0/login/sso/redirect?redirectUrl=http://127.0.0.1:59898
               │17:12:10 matrix_org  -- | matrix: disconnected from server

NixOS 21.05 using 0.3.0.

Settings:

  matrix.color.error_message_bg                       color    default               
  matrix.color.error_message_fg                       color    darkgray              
  matrix.color.quote_bg                               color    default               
  matrix.color.quote_fg                               color    lightgreen            
  matrix.color.unconfirmed_message_bg                 color    default               
  matrix.color.unconfirmed_message_fg                 color    darkgray              
  matrix.color.untagged_code_bg                       color    default               
  matrix.color.untagged_code_fg                       color    blue                  
  matrix.look.bar_item_typing_notice_prefix           string   "Typing: "            
  matrix.look.busy_sign                               string   "⏳"                  
  matrix.look.code_block_margin                       integer  2                     
  matrix.look.code_blocks                             boolean  on                    
  matrix.look.disconnect_sign                         string   "❌"                  
  matrix.look.encrypted_room_sign                     string   "🔐"                  
  matrix.look.encryption_warning_sign                 string   "⚠️ "                              
  matrix.look.human_buffer_names                      boolean  off                   
  matrix.look.max_typing_notice_item_length           integer  50                    
  matrix.look.new_channel_position                    integer  none                  
  matrix.look.pygments_style                          string   "native"              
  matrix.look.redactions                              integer  strikethrough         
  matrix.look.server_buffer                           integer  merge_with_core       
  matrix.network.autoreconnect_delay_growing          integer  2                     
  matrix.network.autoreconnect_delay_max              integer  600                   
  matrix.network.debug_buffer                         boolean  off                   
  matrix.network.debug_category                       integer  all                   
  matrix.network.debug_level                          integer  error                 
  matrix.network.fetch_backlog_on_pgup                boolean  on                    
  matrix.network.lag_min_show                         integer  500                   
  matrix.network.lag_reconnect                        integer  90                    
  matrix.network.lazy_load_room_users                 boolean  off                   
  matrix.network.max_backlog_sync_events              integer  10                    
  matrix.network.max_initial_sync_events              integer  30                    
  matrix.network.max_nicklist_users                   integer  5000                  
  matrix.network.print_unconfirmed_messages           boolean  on                    
  matrix.network.read_markers_conditions              string   "${markers_enabled}"  
  matrix.network.resending_ignores_devices            boolean  on                    
  matrix.network.typing_notice_conditions             string   "${typing_enabled}"   
  matrix.server.matrix_org.address                    string   "matrix.org"
  matrix.server.matrix_org.autoconnect                boolean  off                   
  matrix.server.matrix_org.autoreconnect_delay        integer  10                    
  matrix.server.matrix_org.device_name                string   "Weechat Matrix"      
  matrix.server.matrix_org.password                   string   "XXXXXXXXXXXX"
  matrix.server.matrix_org.port                       integer  443                   
  matrix.server.matrix_org.proxy                      string   ""                    
  matrix.server.matrix_org.ssl_verify                 boolean  on                    
  matrix.server.matrix_org.sso_helper_listening_port  integer  0                     
  matrix.server.matrix_org.username                   string   "jasom"   
strk commented 1 year ago

I'm having the same problem, but only with matrix.org homeserver, so this sounds like a limitation of matrix.org itself, which requires SSO ?

strk commented 1 year ago

This is the ironic screen I'm shown when trying to follow the weechat-matrix instructions:

                                                   Choose identity provider
                    Log in to matrix.org

   Choose an identity provider to log in

     * [1][IMG][2] GitHub
     * [3][IMG][4] Google
     * [5][IMG][6] GitLab
     * [7][IMG][8] Facebook
     * [9][IMG][10] Apple

   An open network for secure, decentralized communication.
   © 2022 The Matrix.org Foundation C.I.C.

Note how "decentralized communication" and that list of identity providers are in disagreement...

strk commented 1 year ago

The matrix-weechat instructions were:

16:07:51  -- | matrix: The server requested a single sign-on, please open this URL in your browser. Note
             | that the browser needs to run on the same host as Weechat.
16:07:51  -- | matrix: https://matrix.org:443/_matrix/client/r0/login/sso/redirect?redirectUrl=http://127.
             | 0.0.1:58683
16:07:51 =!= | matrix: Error decoding SSO login message from child process:

The last line is what happens after killing the browser (links) I used to follow the instructions

strk commented 1 year ago

Info from #matrix IRC channel on libera.chat:

6:11:35         ilmari | strk: https://matrix-client.matrix.org/_matrix/client/v3/login returns sso,
                        | token, password and appservice flows
16:12:08         ilmari | in that order. maybe weechat only looks at the first one?
strk commented 1 year ago

The code seems to ASSUME server requires SSO if it gets a redirectURL typed response

strk commented 1 year ago

It looks like while this fails with weechat-python 0.2.0-2 as packaged by Debian GNU/Linux 11 (bullseye), it is fixed by installing weechat-matrix from current master branch as of 989708d1fa8fcee6d5bbb4c19a7d66f14d84fd5b