Listmonk API authentication

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.0.6
What app is this about: listmonk

Describe your issue

Hi All,

I installed yunohost and listmonk yesterday and still trying to figure it out. Main purpose was to use Listmonk’s APIs but i can’t find how to use them. It works from browser trying to acess endpoint when i’m logged in (probably authneticating with session) however i can’t access it remotely from another server. Responds as 302 (which redirects to login screen)

How can i create a token,key username password or whatever it takes to authenticate from a remote server?
Documentation says “API requests require BasicAuth authentication with the admin credentials.” i already tried my admin credentials it didn’t work. Here’s my php code for that. It returns 302. Please help :slight_smile:

<?php $url = "https://domain.com/api/health"; $username = "my_username"; $password = "my_password"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); $response = curl_exec($ch); if(curl_errno($ch)) { echo 'cURL error: ' . curl_error($ch); } else { echo 'Response: ' . $response; } $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); echo "HTTP Status Code: " . $status_code; curl_close($ch); ?>

Share relevant logs or error messages

request returns: HTTP Status Code: 302

During installation, did you chose the app to be available to visitors? Would you mind sharing installation logs? These are available in web admin->tools->logs, select the relevant log and ‘Share with YunoPaste’.

Hi orhtej,

I removed and reinstall it to root of a domain.
App is available to visitors, at app page it says

Groups / users currently allowed to access this app:
visitors, all_users…

Here’s the log
https://paste.yunohost.org/raw/feyeregeta

I think the end point is right https://mydomain.com/api/subscribers i can see subscribers after login from browser, since the session is active, however i can’t access from a remote server.

Should i use my admin username and password which i use to login to https://mydomain.com/yunohost/admin/

or is it the password provided in app’s page like;

  • Host: 127.0.0.1
  • Port: 25
  • Auth protocol: PLAIN
  • User: listmonk
  • Password: ***

Anyway i tried both still nothing.
Looking forward for your help. Thx.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.