dash-auth icon indicating copy to clipboard operation
dash-auth copied to clipboard

Release of the post login hook with OIDC

Open FlxPo opened this issue 10 months ago • 2 comments

I was trying to implement some post login logic by following the instructions in the after_logged_in method from @clement-chaneching (https://github.com/plotly/dash-auth/blob/main/dash_auth/oidc_auth.py#L273), but could not get it to work.

 """
       Post-login actions after successful OIDC authentication.
       For example, allows to pass custom attributes to the user session:
       class MyOIDCAuth(OIDCAuth):
           def after_logged_in(self, user, idp, token):
               if user:
                   user["params"] = value1
               return super().after_logged_in(user, idp, token)
"""

I realized that this code was not released... Are there any plans for a new release integrating the latest changes to the package ?

Based on the code from 2.3.0, I ended up having to reset the server url rule for the OIDC callback in the __init__ of a MyOIDCAuth class, providing an overriden callback method (which then returns the overriden after_logged_in method). Without this my new after_logged_in method was never called (but it's possible I'm just confused about how inheritance works in this case).

FlxPo avatar Mar 14 '25 12:03 FlxPo

As a quick solution: just derive your own class from OIDCAuth as in your example above and copy callback and after_logged_in from

https://github.com/plotly/dash-auth/blob/main/dash_auth/oidc_auth.py#L273

slavakx avatar Jun 05 '25 13:06 slavakx

I also stumbled upon the same issue and wanted to bringt it up again: Are there plans to release a new version of dash-auth including the after_logged_in method of OIDCAuth any time soon? Cheers!

m-janyell0w avatar Jul 16 '25 12:07 m-janyell0w