mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Enhancement]: Add SSO Support (OIDC) #650
Closed
opened 2026-04-24 23:15:40 +02:00 by adam
·
36 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
s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
v1.3.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
enhancement
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#650
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @DDriggs00 on GitHub (Sep 22, 2022).
Describe the feature/enhancement
The previous attempt at implementing SSO is not valid for the current version of the app.
OIDC, SAML and LDAP appear to be the most popular methods of doing this.
@pto199 commented on GitHub (Oct 12, 2022):
I would like to see this. ODIC is the best method I think.
Im currently setting up Authentik and have some users now with Authentik usernames and passwords. It would be great if they can just visit audiobookshelf and have an account auto-create for them so I dont need to make them an account. Also they could sign on via the android/ios app with their authentik username and password. I cant bear to give my users yet another username an password for yet another app (Which they will again independently forget eventually).
2FA should be put on the backburner I say until SSO is done, cause most SSO solutions these days also do 2fa
@kurokay commented on GitHub (Oct 27, 2022):
OIDC would be awesome !
@BCNelson commented on GitHub (Nov 24, 2022):
I think that I'm going to take a crack at SSO. @advplyr you said in this commented that you are going to want some more design work done on this. What do you feel is the best way to get this design work done. I see a few options.
or any combination of the above. Let me know.
Also it seems like a bit problem with the last PR was you not being able to easily setup a SSO server. I think that a vscode devcontainer could help out with that. I will set one up one the branch that I end up using.
Edit: there is also a discussion that was started since the last time I looked #1210 we could discuss there as well
@advplyr commented on GitHub (Nov 24, 2022):
@BCNelson Your help would be great! With something like this that I'm not familiar with it's useful to highlight some self-hosted software that already has this feature. I know a few have been mentioned but I haven't looked into them yet.
It seems like the mobile app especially complicates things here. There is a related discussion here https://github.com/advplyr/audiobookshelf-app/issues/254
It's probably best to discuss on Discord to start off then if we get a PR going we could discuss there as well.
@Eschguy commented on GitHub (Dec 6, 2022):
I'd love LDAP support
@michaelkrieger commented on GitHub (Feb 8, 2023):
Adding my comment from another issue:
Something like Authelia adds Remote-User and Remote-Groups HTTP headers as the verify middleware is trigged. This would let you get a trusted username of the currently logged in user. This would be on the server-side of things. You'd then need the iOS/Android app to identify when authentication is required and open a web page so you can do the web-based authentication and the cookies can be grabbed. It would then need to pass the cookie with future requests. This is probably the simple way. Most other authentication backends work the same way.
The complicated/future-proof way would be to do Oath2 authentication again supported by Authelia. Same idea that the client apps would need to interface with this to prompt the user.
@amuttsch commented on GitHub (Feb 14, 2023):
There is also an open MR to add LDAP support: https://github.com/advplyr/audiobookshelf/pull/1303
Would love to see it merged, I'm in the process on migrating all my services to LDAP / OAuth.
@michaelkrieger commented on GitHub (Mar 3, 2023):
It may be worth noting a similar discussion here ( jellyfin-meta issue 28 ) talking about implementing it for Jellyfin.
Ultimately, a forwardauth provider like authentik/Authelia/etc behind a reverse proxy will not allow access to audiobookshelf at all prior to authenticating. So the things to consider here are:
This of course adds some security to all of the AudioBookshelf system.
OpenID simply protects the login and frankly is a different approach, only adding SSO. Advantage being that it doesn't need a reverse proxy.
@lukeIam commented on GitHub (Mar 4, 2023):
General question: I read a lot here about LDAP and OpenID implementations here.
Why not integrating an existing and proven authentication middleware that supports multiple auth methods?
e.g. https://www.passportjs.org
I started to have a look into audiobookshelf auth code on the server side and started to do the first modifications.
And integrating passport.js looks not too difficult (disclaimer: I never used passport.js before...)
@tlow92 commented on GitHub (Mar 6, 2023):
@lukeIam I think for most people the reason is that if they host their own sever they also want their own authentication instead of relying on third party providers like google, auth0, etc. (not speaking for myself necessarily, but I understand this reasoning)
@advplyr Is there an update of current situation I might be able to help. If browser redirect on mobile is your concern, keycloak can be configured to use
grant_type=passwordand the same forms that are currently used. This can also be combined with TOTP authenticator codes.@lukeIam commented on GitHub (Mar 6, 2023):
@tlow92 I totally understand this - I'm currently starting setting up my own auth server ;)
But passport.js supports many auth providers (also custom hosted ones) and it's easy to add (or remove) them.
Here's a list: https://www.passportjs.org/packages/
e.g. openidconnect, authentiq or ldap
This would give audiobookshelf the possiblity to support multiple (selected) auth methods/provides without much hassle and it would profit from a commonly used and maintained solution/code.
@lukeIam commented on GitHub (Mar 24, 2023):
sorry for not writing for three weeks - I started with a passportjs integration PoC but then got ill...
Today I finally was able to finish it: https://github.com/advplyr/audiobookshelf/pull/1636
please let me know what you think...
@lukeIam commented on GitHub (Apr 16, 2023):
I've added the openIDConnect strategy and was able to authenticate using Authentik with a
OAuth2/OpenIDprovider.The next step would be bringing it to the client - but here I need help to understand how it currently works (e.g. interaction between api and web server) and how we could integrate it.
High level plan:
@josephholsten commented on GitHub (May 10, 2023):
Hey there, I’m one of the contributors to the openid and oauth specs, and have done tons of auth integration in ruby, consulted for c# & Java customers. I’d strongly support @lukeIam’s approach of using authentication middleware for the first implementation.
The reason being: different auth[nz] require different state to be managed on the server side. Some things need a consumer id & secret, some things need a nonce, some things have multiple records to keep track of to refresh auth. It’s basically whack a mole for your user, group & session data structures until you get a decent handful implemented.
But once you’ve implemented delegated auth with a decent middleware framework, sometimes you will want to rip it out to replace it with something custom that better suits your needs. Usually, this has to do with group membership and resource access control. (And I’m wanting groups and access control so I can limit my kids access to some of my audiobook library ;-) Still, you’ll want the last common denominator in place before you tackle it.
Sadly, I’m about a decade out of date when it comes to node app dev, so I’m not a reliable code reviewer.
@GamerClassN7 commented on GitHub (Aug 4, 2023):
Hello, Are there any plans for SSO Integration ? or estimated timeframe of integration ? thank you in advance"
BTW this piece of software is tonally awesome :D
@lukeIam commented on GitHub (Aug 16, 2023):
maybe next week I'll have some time to further investigate (but can't promise that I get it running)
@knurhp commented on GitHub (Aug 29, 2023):
For those looking for it - booksonic has LDAP support, might have to use that in the interim while ABS implements it's version of it...
Hopefully it won't be long as personally I prefer ABS to booksonic
@lukeIam commented on GitHub (Sep 13, 2023):
sorry - took a bit longer but made some progress (still some stuff to do)
@advplyr commented on GitHub (Nov 20, 2023):
OIDC support has been added. This issue will be for OIDC specifically, #185 can be the issue for LDAP, and SAML can be put in as a separate issue if that is still wanted.
OIDC is available now on the
edgedocker image. A new page for authentication settings has been added where you can enable and configure OIDC.If anyone wants to help test this before it is released that would be helpful to ensure we didn't miss anything for your SSO setup. There is no guide written yet but you can see screenshots in the original PR https://github.com/advplyr/audiobookshelf/pull/1636#issuecomment-1793833884
The current mobile app will not work but if you build the mobile app from source it will work. The working mobile app will probably be released this weekend and the server shortly after.
@igor47 commented on GitHub (Nov 20, 2023):
for Authentik:
Providers, selectCreate, thenOAuth2/OpenID Provider. I picked theimplicitauthorization flow, and left all other settings at their defaults. Note down theClient IDandClient Secretfrom the provider.Applications, selectCreate, then give it a name, a slug, and link it to your new provider from step 1. note down theslugAuthentication, selectOpenID Connect Authentication. paste theClient IDand theClient Secretinto the relevant fields. For theIssuer URLfield, it will behttps://your.authentik.url/application/o/your-application-slug/.after filling out the
Issuer URL, i hitAuto-populateand the rest of the fields filled in automagically. I was able to log in via SSO in an incognito window. Afterwards, i disabledpassword authenticationinAuthenticationsettings. Now, the login screen doesn't even prompt for the password. I do, however, still have password settings if I access my account info by clicking on my username in the upper-right (at/account). the SSO still doesn't work in mobile (see https://github.com/advplyr/audiobookshelf-app/issues/949 ) but this might be because my app version is still too old (i didn't build from source)@Sapd commented on GitHub (Nov 21, 2023):
To add to this, in Authentik or other SSO software the redirect uri has to be set to:
Don't use wildcards like
.*, they are not required.(In Authentik its seperated by new line, in Keycloak by comma afaik).
Also make sure your reverse proxy creates a
X-Forwarded-Protoheader correctly, otherwise you might receive a redirect_uri mismatch, because the redirect_uri is set to http even when the request was made using https.@igor47 commented on GitHub (Nov 21, 2023):
ah thanks for that! in Authentik, it says:
so in my case, since i tested with the web version first it saved my web URI. it would then have failed on mobile with an 'invalid redirect' error
@adepssimius commented on GitHub (Nov 21, 2023):
Tested and functional with Authelia. That discovery button is a very welcome addition. Are there docs that I can contribute to for Authelia setup?
@nichwall commented on GitHub (Nov 21, 2023):
There is not an existing guide yet, but it would be great if you wanted to help out with the documentation. You can copy one of the existing guides as a template in the below directory to add a new User Guide to the website.
https://github.com/advplyr/audiobookshelf-web/tree/master/content%2Fguides
It would probably be best to have all of the different OIDC on the same page, sort of like how the reverse proxies are on the GH readme.
@Nuuki9 commented on GitHub (Nov 22, 2023):
Any chance you could share your Authelia config @adepssimius? This is what I'm trying currently:
It brings up the OIDC page but then I get an internal server error.
@adepssimius commented on GitHub (Nov 22, 2023):
@Nuuki9 Here is a WIP version of the guide I'm writing for SSO config, which includes excerpts from my functional Authelia config.
https://github.com/adepssimius/audiobookshelf-web/blob/master/content/guides/11.sso_configuration.md
Do you have Authelia confirmed to work as an OIDC provider with anything else already?
@Nuuki9 commented on GitHub (Nov 22, 2023):
Many thanks - I'll take a look.
I use OIDC via Authelia with Immich, so I at least got some practice in getting that up and running :-)
@Nuuki9 commented on GitHub (Nov 23, 2023):
That worked great - many thanks!
@lukeIam commented on GitHub (Nov 24, 2023):
Tested with the
edgecontainer and Authentik -> is working smooth so far 👍@advplyr commented on GitHub (Nov 28, 2023):
Added in v2.6.0
@skyzuma commented on GitHub (May 3, 2024):
is there a working guide for authentik?
@DDriggs00 commented on GitHub (May 3, 2024):
Igor posted one earlier in this thread.
@skyzuma commented on GitHub (May 3, 2024):
with nginx proxy manager?
edit: saved info was 3 error ... but 4th time was successfull but cant outh ...
@skyzuma commented on GitHub (May 3, 2024):
it worked but websocket failed cause of an nginx proxy manager problem
https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3474
if i delete the connection_upgrade_keepalive section, npm will work but WebSocket will not work ... i think we need to wait for an npm update in general ...
@Sapd commented on GitHub (May 3, 2024):
The reverse proxy should not matter/affect with the oidc feature (except that the right X-Forwarded-For must be there).
Personally, I advise not using NPM, and instead traefik, caddy (very easy) or nginx directly.
@skyzuma commented on GitHub (May 3, 2024):
it work now ... i forgot to delete the entry in the advanced tab (npm gui) for an authentik proxy-provider ... no its a oidc-provider and dont need this entry ...