Guide: Setting up SFTPGo admin logins to work with Authentik #1516
Replies: 5 comments 7 replies
-
I had this working, then I had to rebuild my server core, and, with what I think is identical to before and folling what you have here, I get this ("Failed to get user associated with OpenID token") as an error, and am told that the account is an admin on the webclient login. I do know that SFTPGo doesn't support dynamic creation/updating of specifically admin users, so I did premake the admin with the same username that is given when oidc creates a client user. Did you have any related trouble? |
Beta Was this translation helpful? Give feedback.
-
This has been driving me crazy for entirely too long. Thank you! Am I right in my understanding that a user can use WebClient or WebAdmin, but not both? If the user is in the admin group they can't log in to the WebClient? |
Beta Was this translation helpful? Give feedback.
-
Please, could you provide complete manual for setting up authentik with sftpgo? And it doesn't work: could not start HTTP server: oidc: unable to initialize provider for URL "https://authentik.domain/application/o/sftpgo/": 403 Forbidden |
Beta Was this translation helpful? Give feedback.
-
With the above setup, my user sessions expire after 5 minutes. There is no refresh token provided by Authentik by default, so the session is not extended. I can also see this in sftpgo logs. Is this also happening for you? My workaround was adding the offline_access scope in both Authentik and sftpgo, however I am not sure if this is a correct solution. Now at log in my users end up in the explicit flow instead of implicit. Other applications like Grafana did not need this scope, and the sessions still stay alive for a longer time. |
Beta Was this translation helpful? Give feedback.
-
For anyone else stumbling on this discussion, I was able to find a way to allow the same SSO user to login on WebClient and AdminClient. Rather than passing sftpgo_role as 'admin' or 'user'. I set the environmental variable called "implitcit_roles", this basically sets the role based on the login link used. Reference: https://docs.sftpgo.com/latest/env-vars/ |
Beta Was this translation helpful? Give feedback.
-
It took me a bit to get this sorted, so I figured I'd share how!
First, navigate to Directory -> Groups and create a group called
SFTPGo Admins
. Add your desired users to the group from the Users tab in the group.Now, under Customisation -> Property Mappings, create a new "Scope Mapping".
Set the Name to
sftpgo
, the Scope name tosftpgo
, and the expression to the following:Now, under Applications -> Providers, create a new OAuth2 provider for sftpgo. Set it up like normal as the OIDC docs say. However, under Advanced protocol settings, add

sftpgo
to the Scopes:Finally, in your sftpgo configuration, set the Open ID scopes to include the new scope and the role field. Here's mine from docker-compose.yml. I’ve added
sftp
to the default scopes listed at https://docs.goauthentik.io/docs/add-secure-apps/providers/oauth2/#default.After restarting sftpgo (remember to do down / up if you're using docker compose!), you should be able to log in to the WebAdmin UI.
The only thing I don't have working is for the same user to be able to log in as a regular user. When I try, I get:
That error makes me think this is an intentional design decision, and in my case doesn't matter as I need to create separate users anyways.
Beta Was this translation helpful? Give feedback.
All reactions