victorbalssa / abacus

🟠 Abacus: Firefly III mobile application.
https://apps.apple.com/us/app/1627093491
GNU General Public License v3.0
565 stars 42 forks source link

Bug: "Failed to validate AccessToken, please re-check your token or backend URL" #256

Closed paulcalabro closed 8 months ago

paulcalabro commented 8 months ago

Describe the bug Receiving the following error message when logging in using a Personal Access Token:

Failed to validate AccessToken, please re-check your token or backend URL

To Reproduce Steps to reproduce the behavior:

  1. Go to "Credentials" -> "Add Credential"
  2. Fill in URL, select "User Personal Access Token"
  3. Enter access token
  4. See error

Expected behavior Arrive at landing page

Screenshots N/A

Smartphone (please complete the following information):

Additional context N/A

paulcalabro commented 8 months ago

https://github.com/victorbalssa/abacus/blob/8e1ca674ddff9b29cae74b841058a2243a411f10/src/components/Screens/CredentialCreateScreen.tsx#L91

victorbalssa commented 8 months ago

Hey @paulcalabro,

Was PAT working before 0.12.4? can you retry with a new PAT again?

I'm also trying to narrow down the login issues others can have (#257): Can you try to connect to this demo instance: https://demo.firefly-iii.org/ ? it will help me determine if it's really Abacus 0.12.4 with some iPhone configurations.

Do you use the latest FireflyIII version? (6.1.9)

Last thing, if you have access to an android, (if you can you replicate the same error on android)?

Thanks

paulcalabro commented 8 months ago

Hey @victorbalssa,

Here's the answers to your questions

I set up Burp Suite to act as a Proxy in between my phone and Firefly III. I noticed if I clicked on "Create a new Personal Access token on OAuth tab, here: <URL>" I saw traffic to the proxy. If I clicked on "Log in" (same URL, with a PAT), I saw no traffic to the proxy. If I used an IP address and a NC listener, I saw traffic.

victorbalssa commented 8 months ago

Thank you @paulcalabro, it will help me a lot, I suspect the last build to block some specific LAN traffic on IOS. I will replicate it on a raspberry pi, and keep you posted.

paulcalabro commented 8 months ago

@victorbalssa

You're welcome!

Given I could send traffic to a netcat listener (e.g. 192.168.68.123 on port 1234") and see traffic, I don't think it's necessarily blocking LAN traffic.

e.g.

Initially, I was thinking what was happening and what could explain for the difference in behavior is name resolution:

As I started to examining the DNS logs on my Pi-hole, I noticed something interesting: I couldn't see DNS queries being made for HTTP traffic:

signal-2024-03-04-161640_002

signal-2024-03-04-161640_003

Screenshot 2024-03-04 161443

Maybe something expects TLS and is silently failing?

paulcalabro commented 8 months ago

@victorbalssa

Okay, I was able to resolve my issue! 🥳 It looks like it is related to TLS.

For those experiencing the same issue, the tl;dr is I created a local CA, created a cert issued by that CA, and deployed the CA cert to my phone and computer. I then configured Traefik to use the cert issued by the CA.

Helpful resources:

Sample v3.ext:

extendedKeyUsage = serverAuth
subjectAltName   = DNS:<FQDN>

Things that the first link doesn't cover OTB:

So I think what's broken is the ability to NOT use TLS.

victorbalssa commented 8 months ago

This makes a lot more sense to me! 🎉

I will create a new version with the ability to use TLS AND unsecured http,

Thanks again @paulcalabro 💯

victorbalssa commented 8 months ago

Done in 0.13.2. Let me know if there is still an issue with this.