PocketID and Android App Error

Just setup PocketID with Vikunja.

Works fine on my pc browser.

Works find on my android browser.

When using the app I enter my user and then select to login via the frontend. Browser opens but generic something went wrong error with pocket id. If I generate a code in PocketID I can login that way and it takes me back to the app. I can navigate around ok.

If I close the app and open it again I get:

type ‘String’ is not a subtype of type ‘Map<String,dynamic>?’

Check this issue for details: bug - async error · Issue #204 · go-vikunja/app · GitHub

Hey. I’d actually ran into that one before

I’ve been on the unstable version since then and have been keeping it updated. All has worked great until I implemented the oauth and tried the app.

I just re-enabled local auth, cleared the app cache and confirmed I can login with my original “local” user. I logged in solely with the app.

I then logged out and tried the front end option. This gave me the error (while on the login screen) of ‘this account is managed by a third-party authentication provider’

That may just be some confusion with account names due to me having a local and then adding an oauth one and not super relevant.

Was playing around some more.

Deleted all vikunja users

Disabled local auth

Logged in with my pocketid auth in the pc browser - created user and all looks good

Tried to login with the Android app (using frontend option)

Got ‘unknown error occurred’

Looked at my pocket id logs in docker and clicked the hyperlink it’s trying to auth with.

That gave me:

State does not match, refusing to continue!

I see this message is in the vikunja codebase so may provide some idea? Or using the url directly may just not work and this is a bad test.

If you’re using a third-party auth provider, you’ll need to use the “Login with frontend” option. This is a little confusing but we’re working on that.

It made sense to me :slight_smile:

But that’s what got me to this error:

The fact I had to use a code because PocketID was giving me the ‘unknown error has occurred’ no doubt has something to do with it.

Is there something special I need to add in my oauth client to handle the mobile app? Again, all works great from the browser.

Huh as long as it works in the browser and you’re using the „Login with frontend“ option, it should work fine, because in that case the app is using the frontend to log in (as the name implies). It might be related to something with cookies or such because the web view that’s used by the app when logging in with the frontend might be more restricted than a browser.

I probably should mention I am using the environment config in the compose file. I assume it’s all good since the browser is working.

VIKUNJA_AUTH_LOCAL_ENABLED: false
VIKUNJA_AUTH_OPENID_ENABLED: “true”
VIKUNJA_AUTH_OPENID_PROVIDERS_POCKETID_AUTHURL: ``https://id.example.com
VIKUNJA_AUTH_OPENID_PROVIDERS_POCKETID_CLIENTID: xxxxxxxxxx
VIKUNJA_AUTH_OPENID_PROVIDERS_POCKETID_CLIENTSECRET: xxxxxxxxxxxxxx
VIKUNJA_AUTH_OPENID_PROVIDERS_POCKETID_NAME: PocketID
VIKUNJA_AUTH_OPENID_PROVIDERS_POCKETID_SCOPE: “openid profile email”

Unstable release

Pocket ID callback url:

https://tasks.example.com/auth/openid/pocketid

Anyone here using pocket ID and the android mobile app?

Looked some more today and config seems fine (and still working with web) so seems like it has to be something in the Android App itself or the ‘frontend login’.

1 Like

Asked on the pocketid GH also: Vikunja client isn't working with the android app · pocket-id/pocket-id · Discussion #1237 · GitHub

Hi there, I wanted to second @kramttocs’s experience. I’m self-hosting Vikunja and using PocketID for single sign-on using passkeys. The PocketID auth flow works fine on both my PC browser and mobile browser. However, here’s my experience when logging in via the Vikunja mobile application (installed from Google Play Store):

  • I open the Vikunja mobile application, select Custom Server URL , key in my subdomain for Vikunja i.e. https://tasks.my.domain, then click Login.

  • I’m redirected to my mobile browser (not a WebView, it actually opens my mobile browser) where I see the Vikunja login page.

    • During this phase, I see the mobile browser URL bar redirect from https://tasks.my.domain/oauth/authorize to https://tasks.my.domain/login
  • I click on Log in with PocketID and I’m redirected to my centralized auth subdomain, https://auth.my.domain/authorize where I see the PocketID UI.

  • I click Sign in, my password manager (Bitwarden) pops up and I select the assigned passkey for my PocketID admin account.

  • A green checkbox appears on the PocketID UI indicating that the sign-in process was successful, and I’m redirected to the Vikunja web UI (on my mobile browser).

  • The Vikunja mobile web UI briefly shows a message stating “You have been redirected to the app. You can close this tab now”. I also see that my auth flow has successfully logged me in on my browser.

  • After that, I’m automatically redirected back to the Vikunja mobile app, where it shows an error message stating “Could not connect to this server. Make sure a Vikunja server is running under that instance.”. This error message is displayed under the input form for the server address.

For reference, here’s my Vikunja OIDC client configuration on the PocketID administration dashboard:

  • Name: Tasks
  • Client launch URL: https://tasks.my.domain
  • Callback URLs: https://tasks.my.domain/auth/openid/pocketid
  • Public Client and PKCE are disabled
  • Only one user group is added, my Admin user group, which my user is a member of.

On my server, here’s the config.yaml file I’m using to configure Vikunja’s auth flow:

auth:
  openid:
    enabled: true
    redirecturl: https://tasks.my.domain/auth/openid/pocketid
    providers:
      PocketID:  
        name: PocketID
        usernamefallback: true
        emailfallback: true
        authurl: https://auth.my.domain
        clientid: <Client ID generated by Pocket ID>
        clientsecret: <Client secret generated by Pocket ID>
        scope: openid profile email
        forceuserinfo: false

I haven’t tried running Vikunja server using the unstable tag. Should I attempt that first, or will that not address this specific issue? It seems that the primary auth flow works, but something about how the Android app redirects after auth is causing it to fail.

@roshennair can you open an issue on github about this?

@kolaente I’ve already added a comment detailing my issue under @kramttocs’s GitHub discussion post. Would it be more helpful if I opened a separate GitHub issue instead?

1 Like

@kolaente As requested, I’ve created a new issue on GitHub: 🐛 Bug Report: Vikunja Android app unable to connect to server after authenticating with Pocket ID · Issue #1468 · pocket-id/pocket-id · GitHub

@kolaente I’ve closed the aforementioned issue as it was incorrectly created in the pocket-id repository. I’ve now created a new issue in the go-vikunja/app repository: Vikunja Android app unable to connect to server after authenticating with Pocket ID · Issue #265 · go-vikunja/app · GitHub