christian-putzke / freshrss-pocket-button

Add FreshRSS articles to Pocket with one simple button click or a keyboard shortcut.
MIT License
7 stars 1 forks source link

Cannot connect app with FreshRSS on different port #1

Closed ghost closed 1 month ago

ghost commented 1 year ago

my FreshRSS instance is self-hosted and does run on a non-standard port. When I click the "connect" button in the Pocket Button config to authorize with pocket, the redirect_uri parameter generated for the https://getpocket.com/auth/authorize request doesn't include that port.

I believe this leads to the autorization failing. To be more precise, it looks like the authorization does happen on Pocket's side, but FreshRSS / the extension is missing the response and never recognizes that it is authorized.

if I tweak the pocket.com Authorization URL to contain the port the redirection does seem to work but the connection isn't established. In my pocket.com settings the third-party app I created is listed as authorized, but clicking the pocket icon in FreshRSS yields an error "Adding article to Pocket failed! Pocket API error code: 107"

The pocket button in FreshRSS is only an outline by the way, even after my hacked attempt at fixing the redirect_uri.

Any ideas?

ghost commented 1 year ago

Turns out I was facing two issues: The extension doesn't seem to work unless the keyboard shortcut is configured. I added the keyboard shortcut in the extension config, then went through the hacky authorization process described in the OP and now I can add items to my pocket.

Note that the issue with the port still persists and maybe can be fixed

MattDemers commented 1 year ago

@MrOnak Not the dev, but curious about getting this working.

Is the keyboard shortcut only one character? Which one did you use?

Which URL did you change? The one leading to the page that has the "Authorize" and "No, thanks" buttons? Or the one after clicking "Authorize"?

Edit: I got it working

Clicked the authorize button, got a 404 page with the URL http://xxx.xxx.x.xxx/i/?c=pocketButton&a=authorize, then changed it to http://xxx.xxx.x.xxx:9009/i/?c=pocketButton&a=authorize and I got an "authorization successful!" message.

ghost commented 1 year ago

@MattDemers

I don't know how flexible the keyboard shortcut can be, I don't use them. But I've set it to lower-case p and the extension is satisfied. Glad you got the redirect URL to work :)

christian-putzke commented 1 year ago

I'll have a look on the redirection issues and try to fix it for the next release in a few days.

Turns out I was facing two issues: The extension doesn't seem to work unless the keyboard shortcut is configured.

What exactly was not working when you didn't had a keyboard shortcut defined? It should work when you press on the Pocket Button with your mouse at least. Would you expect a default keyboard shortcut to exist?

christian-putzke commented 1 year ago

I've setup a docker container and tested the Pocket authorization process with port 8080 and also 9009. It worked just fine for me and forwarded the port properly during the authorization redirect.

Did you maybe add the port later to the freshRSS installation? How does the URL to pocket look like? For me it looked like this: https://getpocket.com/auth/authorize?request_token=XXXredirect_uri=http://localhost:9009/i/?c=pocketButton%26amp;a=authorize

The extension also works fine without a keyboard shortcut being setup. You just need to press the pocket button on a feed entry for it to work. Verified this while testing the port forwarding in the docker container.

ghost commented 1 year ago

Okay, interesting. Not quite sure what you mean regarding the ports though. My docker compose file forwards the container port 80 to 44185. That was never changed as far as I can tell.

The URL to looks like this (copied from the browser URL bar): https://getpocket.com/auth/authorize?request_token=REDACTED&redirect_uri=http://brian.local/i/?c=pocketButton%26amp;a=authorize

If I change it to add the port, then it works https://getpocket.com/auth/authorize?request_token=REDACTED&redirect_uri=http://brian.local:44185/i/?c=pocketButton%26amp;a=authorize

christian-putzke commented 1 year ago

Docker is new to me to be honest and I'm not sure if I did everything right and in the same way than you.

I followed the FreshRSS quick run guide (https://github.com/FreshRSS/FreshRSS/tree/edge/Docker#quick-run) and used -p 8080:80 and -p 9009:80 in the docker run command.

I used the URL http://localhost:9009 to access the installation in my browser and tested the Pocket authorization process there. That worked fine for me.

Can you maybe write me a quick guide how I can reproduce the issue? That'd be awesome!

ghost commented 1 year ago

Well I don't know about a guide -- I'm also far from being very knowledgeable regarding docker. But below is my docker-compose file that I'm using to set up the container.

version: "2.1"
services:
  freshrss:
    image: lscr.io/linuxserver/freshrss:latest
    container_name: freshrss
    hostname: freshrss
    networks:
    - selfhosted
    ports:
      - 44185:80
    environment:
      - PUID=1002
      - PGID=100
      - TZ=Europe/Berlin
    labels:
      - com.centurylinklabs.watchtower.monitor-only=true
      - homepage.name=RSS reader
      - homepage.description=freshRSS newsfeed aggregator
      - homepage.group=externals
      - homepage.icon=freshrss.png
      - homepage.href=http://brian.local:44185
    volumes:
      - /mnt/docker/volumes/freshrss/data:/config
    restart: unless-stopped
networks:
  selfhosted:
    external: true

You can ignore all labels, they're just there to integrate with my watchtower container for automatic detection of updates and another homepage container that I use as dashboard. My network settings need improvement but it works for now.

I'm not mapping the HTTPS port since I'm still running in a HTTP-only environment that's LAN-only and not connected to the internet.

PUID/PGID are the user/group id of the host-side user/group that I want the container /config files to be. You probably have to adjust this for your setting, or just leave them out.

One thing that seems odd about your last post: you're mapping the container port 80 twice, once to 8080 and once to 9009. Was that a typo or is it on purpose? I'm not sure how that would affect the pocket redirect UR either way, just something I noticed.

christian-putzke commented 10 months ago

Does this issue still happen with v0.4? I was unfortunately not able to reproduce it so I don't know if it is fixed or not.