Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Unable to use API for firefly-iii

    Firefly III
    2
    5
    223
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lepisma
      lepisma last edited by

      Hi,

      I recently installed firefly-iii from cloudron marketplace. While the application itself is working nicely, I needed to write a custom importer and for that wanted to hit the REST API.

      The API is supposed to be present at /api/v1/... but I am always getting the login HTTP page back. I was thinking there is some issue with my code, request headers, etc. But I tried changing the url from https://<my-website>/api/v1/transactions to https://demo.firefly-iii.org/api/v1/transactions (firefly's demo server) and the same requests are working.

      Is this related to how cloudron is setting up firefly-iii? I also checked firefly-iii configuration and there was no way to enable/disable REST API.

      Can I get some help here?

      girish 1 Reply Last reply Reply Quote 1
      • girish
        girish Staff @lepisma last edited by

        @lepisma I can reproduce this one.

        I suspect this has to do with proxyAuth in the package not configured properly for API access (it's not passing through bearer headers). Investigating.

        1 Reply Last reply Reply Quote 1
        • girish
          girish Staff last edited by

          I misunderstood what 'Command line token' means. I thought this was the API token. It isn't. It's actually the token for running cron jobs over the web - https://docs.firefly-iii.org/firefly-iii/advanced-installation/cron/#request-a-page-over-the-web

          1 Reply Last reply Reply Quote 0
          • girish
            girish Staff last edited by girish

            Indeed, one must create a Personal Access Token from the OAuth page.

            13988f2d-cb15-4b95-8944-fc42702b4e42-image.png

            $ curl -LX GET 'https://ff3.example.com/api/v1/about'  -H 'accept: application/vnd.api+json' -H 'Authorization: Bearer xx'   -H 'Content-Type: application/json'
            {"data":{"version":"5.7.10","api_version":"1.5.6","php_version":"8.0.21","os":"Linux","driver":"pgsql"}}
            

            The above works without proxyAuth. Will now test with proxyAuth enabled.

            1 Reply Last reply Reply Quote 0
            • girish
              girish Staff last edited by

              To support Bearer authentication with proxyAuth, I have added a new flag in the manifest called supportsBearerAuth . This will be available in 7.3. After that, the curl request works.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB