Invalid access token passed #45

Open
opened 2023-12-15 13:33:55 -05:00 by crmado · 0 comments

System Information

  • server: ubuntu23.04 server
  • python: 3.11
  • Nodejs: v18.13.0
  • yarn: 1.22.19
  • postgresql: 11

I followed the process until "Running manually" and encountered the issue of continuously finding "Invalid access token passed."

config.yaml:

homeserver:
     address: https://test.domain.com

     domain: domain.com

     verify_ssl: true
 appservice:
  
     address: https://test.domain.com:29394
  
     tls_cert: /etc/letsencrypt/archive/matrix.crmado.tw/fullchain1.pem
     tls_key: /etc/letsencrypt/archive/matrix.crmado.tw/privkey1.pem
   
     hostname: IP address
     port: 29394
   
     max_body_size: 1
    
    database: postgres://test:testPasswd@localhost/linedatabase
    
    provisioning:
       
        enabled: true
       
        prefix: /_matrix/provision/v1
        
        shared_secret: VZxXLjzKsFtz3I6AWWJpZI-HCKT4oxFYAthr8HBnvVIojGa1VlwGMjoePxFMA4O2
   
    id: line
   
    bot_username: linebot
    
    bot_displayname: LINE bridge bot
    bot_avatar: mxc://miscworks.net/vkVOqyfLTQTfRvlEgEoampPW
   
    community_id: false
    
    as_token: 0o8U9b-K2_dJMc_AbEns9c8cahfGkH047HhWUhCZ36guydBCOSyr6E6dXrXjAhlv
    hs_token: TUmxYOlYcICRFlesATwCC8cPMHc5kyO1VbBuuUMNTTLX1cgRbX1hnco1i3AVqxlJ
    
    ephemeral_events: false

metrics:
    enabled: false
    listen_port: 8000

bridge:
    
    username_template: line_{userid}
    
    displayname_template: '{displayname} (LINE)'
    
    displayname_max_length: 100
    
    initial_conversation_sync: 10
   
    invite_own_puppet_to_pm: false
  
    login_shared_secret:
   
    federate_rooms: true
    
    backfill:
       
        disable_notifications: false
    
    encryption:
       
        allow: false
        
        default: false
        
        key_sharing:
            
            allow: false
            
            require_cross_signing: false
            
            require_verification: true
    
    private_chat_portal_meta: false
    
    delivery_receipts: false
    
    delivery_error_reports: false
    
    resend_bridge_info: false
    
    receive_stickers: true
    
    use_sticker_events: true
   
    emoji_scale_factor: 1

    
    command_prefix: '!line'
   
    user: '@userName:domain.com'
puppeteer:
    connection:
        
        type: unix
        
        path: /var/run/matrix-puppeteer-line/puppet.sock
       
        host: localhost
        port: 29395

logging:
    version: 1
    formatters:
        colored:
            (): matrix_puppeteer_line.util.ColorFormatter
            format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
        normal:
            format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s'
    handlers:
        file:
            class: logging.handlers.RotatingFileHandler
            formatter: normal
            filename: ./matrix-puppeteer-line.log
            maxBytes: 10485760
            backupCount: 10
        console:
            class: logging.StreamHandler
            formatter: colored
    loggers:
        mau:
            level: DEBUG
        aiohttp:
            level: INFO
    root:
        level: DEBUG
        handlers: [file, console]

After setting up the above, when I run python -m matrix_puppeteer_line in the root directory, the following error message is output:

[2023-12-16 01:50:04,906] [INFO@mau.init] Initializing matrix-puppeteer-line 0.1.0+dev.unknown
[2023-12-16 01:50:04,907] [INFO@mau.init] Initialization complete in 0.05 seconds
[2023-12-16 01:50:04,908] [DEBUG@mau.init] Running startup actions...
[2023-12-16 01:50:04,908] [DEBUG@mau.db] Connecting to postgres://test:testPasswd@localhost/linedatabase
[2023-12-16 01:50:05,178] [DEBUG@mau.init] Starting appservice...
[2023-12-16 01:50:05,178] [DEBUG@mau.as] Starting appservice web server on IP address:29394
[2023-12-16 01:50:05,180] [INFO@mau.mx] Ensuring connectivity to homeserver
[2023-12-16 01:50:05,220] [ERROR@mau.mx] Connection to homeserver failed, retrying in 10 seconds
Traceback (most recent call last):
  File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/bridge/matrix.py", line 101, in wait_for_connection
    await self.az.intent.whoami()
  File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/client/api/authentication.py", line 154, in whoami
    resp = await self.api.request(Method.GET, Path.account.whoami)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/api.py", line 259, in request
    return await self._send(method, full_url, content, query_params, headers or {})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/api.py", line 180, in _send
    raise make_request_error(http_status=response.status,
mautrix.errors.request.MUnknownToken: Invalid access token passed.
^C[2023-12-16 01:50:06,718] [DEBUG@mau.init] Interrupt received, stopping...
[2023-12-16 01:50:06,719] [DEBUG@mau.as] Stopping appservice web server
[2023-12-16 01:50:06,719] [INFO@mau.init] Everything stopped, shutting down

I have checked that the as_token and hs_token in the registration.yaml file match those in config.yaml.

registration.yaml

id: line
as_token: 0o8U9b-K2_dJMc_AbEns9c8cahfGkH047HhWUhCZ36guydBCOSyr6E6dXrXjAhlv
hs_token: TUmxYOlYcICRFlesATwCC8cPMHc5kyO1VbBuuUMNTTLX1cgRbX1hnco1i3AVqxlJ
namespaces:
    users:
    - exclusive: true
      regex: '@line_.*:domain\.com'
    - exclusive: true
      regex: '@linebot:domain\.com'
    aliases: []
url: https://test.domain.com:29394
sender_localpart: XWWJchN1qXnX_C2g0D8ayNKZdugwlXIGUMXxPqT_6GppqJLEv4mLUpInnJYBniDt
rate_limited: false
### System Information - server: ubuntu23.04 server - python: 3.11 - Nodejs: v18.13.0 - yarn: 1.22.19 - postgresql: 11 ### I followed the process until "Running manually" and encountered the issue of continuously finding "Invalid access token passed." config.yaml: ``` homeserver: address: https://test.domain.com domain: domain.com verify_ssl: true appservice: address: https://test.domain.com:29394 tls_cert: /etc/letsencrypt/archive/matrix.crmado.tw/fullchain1.pem tls_key: /etc/letsencrypt/archive/matrix.crmado.tw/privkey1.pem hostname: IP address port: 29394 max_body_size: 1 database: postgres://test:testPasswd@localhost/linedatabase provisioning: enabled: true prefix: /_matrix/provision/v1 shared_secret: VZxXLjzKsFtz3I6AWWJpZI-HCKT4oxFYAthr8HBnvVIojGa1VlwGMjoePxFMA4O2 id: line bot_username: linebot bot_displayname: LINE bridge bot bot_avatar: mxc://miscworks.net/vkVOqyfLTQTfRvlEgEoampPW community_id: false as_token: 0o8U9b-K2_dJMc_AbEns9c8cahfGkH047HhWUhCZ36guydBCOSyr6E6dXrXjAhlv hs_token: TUmxYOlYcICRFlesATwCC8cPMHc5kyO1VbBuuUMNTTLX1cgRbX1hnco1i3AVqxlJ ephemeral_events: false metrics: enabled: false listen_port: 8000 bridge: username_template: line_{userid} displayname_template: '{displayname} (LINE)' displayname_max_length: 100 initial_conversation_sync: 10 invite_own_puppet_to_pm: false login_shared_secret: federate_rooms: true backfill: disable_notifications: false encryption: allow: false default: false key_sharing: allow: false require_cross_signing: false require_verification: true private_chat_portal_meta: false delivery_receipts: false delivery_error_reports: false resend_bridge_info: false receive_stickers: true use_sticker_events: true emoji_scale_factor: 1 command_prefix: '!line' user: '@userName:domain.com' puppeteer: connection: type: unix path: /var/run/matrix-puppeteer-line/puppet.sock host: localhost port: 29395 logging: version: 1 formatters: colored: (): matrix_puppeteer_line.util.ColorFormatter format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s' normal: format: '[%(asctime)s] [%(levelname)s@%(name)s] %(message)s' handlers: file: class: logging.handlers.RotatingFileHandler formatter: normal filename: ./matrix-puppeteer-line.log maxBytes: 10485760 backupCount: 10 console: class: logging.StreamHandler formatter: colored loggers: mau: level: DEBUG aiohttp: level: INFO root: level: DEBUG handlers: [file, console] ``` ### After setting up the above, when I run python -m matrix_puppeteer_line in the root directory, the following error message is output: ``` [2023-12-16 01:50:04,906] [INFO@mau.init] Initializing matrix-puppeteer-line 0.1.0+dev.unknown [2023-12-16 01:50:04,907] [INFO@mau.init] Initialization complete in 0.05 seconds [2023-12-16 01:50:04,908] [DEBUG@mau.init] Running startup actions... [2023-12-16 01:50:04,908] [DEBUG@mau.db] Connecting to postgres://test:testPasswd@localhost/linedatabase [2023-12-16 01:50:05,178] [DEBUG@mau.init] Starting appservice... [2023-12-16 01:50:05,178] [DEBUG@mau.as] Starting appservice web server on IP address:29394 [2023-12-16 01:50:05,180] [INFO@mau.mx] Ensuring connectivity to homeserver [2023-12-16 01:50:05,220] [ERROR@mau.mx] Connection to homeserver failed, retrying in 10 seconds Traceback (most recent call last): File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/bridge/matrix.py", line 101, in wait_for_connection await self.az.intent.whoami() File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/client/api/authentication.py", line 154, in whoami resp = await self.api.request(Method.GET, Path.account.whoami) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/api.py", line 259, in request return await self._send(method, full_url, content, query_params, headers or {}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/matrix_line/LINE_service/matrix-puppeteer-line/.venv/lib/python3.11/site-packages/mautrix/api.py", line 180, in _send raise make_request_error(http_status=response.status, mautrix.errors.request.MUnknownToken: Invalid access token passed. ^C[2023-12-16 01:50:06,718] [DEBUG@mau.init] Interrupt received, stopping... [2023-12-16 01:50:06,719] [DEBUG@mau.as] Stopping appservice web server [2023-12-16 01:50:06,719] [INFO@mau.init] Everything stopped, shutting down ``` ### I have checked that the as_token and hs_token in the registration.yaml file match those in config.yaml. **registration.yaml** ``` id: line as_token: 0o8U9b-K2_dJMc_AbEns9c8cahfGkH047HhWUhCZ36guydBCOSyr6E6dXrXjAhlv hs_token: TUmxYOlYcICRFlesATwCC8cPMHc5kyO1VbBuuUMNTTLX1cgRbX1hnco1i3AVqxlJ namespaces: users: - exclusive: true regex: '@line_.*:domain\.com' - exclusive: true regex: '@linebot:domain\.com' aliases: [] url: https://test.domain.com:29394 sender_localpart: XWWJchN1qXnX_C2g0D8ayNKZdugwlXIGUMXxPqT_6GppqJLEv4mLUpInnJYBniDt rate_limited: false ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
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: fair/matrix-puppeteer-line#45
No description provided.