Skip to content

🐛 Bug Report: Wrong authentik auth URL #9567

Closed
deepshekhardas/appwrite
#3

Description

@Voxel07

👟 Reproduction steps

I have self-hosted authentik and appwrite via Docker. I am now trying to use authentik as may oauth2 provider. The problem is, that the auth url appwrite is sending the auth request to seems not to be correct.

The problem seems to be in this function from

/Authentik.php
 public function getLoginURL(): string
    {
        return 'https://' . $this->getAuthentikDomain() . '/application/o/authorize?' . \http_build_query([
            'client_id' => $this->appID,
            'redirect_uri' => $this->callback,
            'state' => \json_encode($this->state),
            'scope' => \implode(' ', $this->getScopes()),
            'response_type' => 'code'
        ]);
    }

the URL should have an additional "/" to look like this: "'/application/o/authorize/?'"

I have set up an auth provider in authentik
Image

And added the details into appwrite auth.
Image

My web app makes an auth request an I land on my auth url, but Authentik complains, with a not found error.

Image

I took a look at the url and noticed that it's different from what authentik wants. I manualy added a "/" after the "authorize" and was correctly authenticated and send back to my webapp with a valid session.

👍 Expected behavior

Get sent to Authentik, Login and redirected back to my application

👎 Actual Behavior

Authentik does recognize the app_id and is stuck with a not found error.

🎲 Appwrite version

Version 1.6.x

💻 Operating system

Linux

🧱 Your Environment

Appwirte Version 1.6 with docker.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    bug
    on Mar 24, 2025
  2. added
    product / auth
    on Mar 25, 2025
  3. Voxel07 commented on Sep 4, 2025

    @Voxel07
    Author

    This is such a simple change. Why is this taking so long?

  4. tromphakvoort commented on Nov 4, 2025

    @tromphakvoort

    Is there an update on the fix of this issue? Or is there an alternative for it?

  5. Voxel07 commented on Nov 4, 2025

    @Voxel07
    Author

    I asked them in one of their Discord Q&As about this. The answer was basically that this seems not to be a wide spread issue and they need more cases to evaluate the Problem.
    I switched to PocketBase for my personal project.

  6. funar commented on Dec 12, 2025

    @funar

    Any updates on this? I modified the source for now, but I'd prefer an official fix. It's just a trailing /

  7. maxmir20 commented on Jan 26, 2026

    @maxmir20

    Also highlighting this issue as well. Hoping someone addresses it soon

  8. funar commented on Jan 26, 2026

    @funar

    If you're using nginx as a proxy in front of Authentik, this works:

        location = /application/o/authorize {
            rewrite ^ /application/o/authorize/ break;
    
            --- other proxy rules here ----
    
        }
    
  9. abishekgiri commented on Mar 31, 2026

    @abishekgiri

    Hi, I'd like to work on this issue. Could I be assigned?

  10. abishekgiri commented on Apr 16, 2026

    @abishekgiri

    Hi, I’d like to work on this issue. Could I be assigned?

  11. rajkumar187 commented on Jul 1, 2026

    @rajkumar187

    Hi! I'd like to work on this issue. From reading src/Appwrite/Auth/OAuth2/Authentik.php, getLoginURL() builds the URL as /application/o/authorize?... — adding the trailing slash to make it /application/o/authorize/?... should resolve the 404. Could this be assigned to me? Thanks!

  12. rajkumar0932 commented on Jul 1, 2026

    @rajkumar0932

    Hi! I'd like to work on this issue. From reading src/Appwrite/Auth/OAuth2/Authentik.php, getLoginURL() builds the URL as /application/o/authorize?... — adding the trailing slash to make it /application/o/authorize/?... (matching the token and userinfo endpoints in the same file, which already have it) should resolve the 404. Could this be assigned to me? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugproduct / auth

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions