How to Set Auth Module in Bokeh Server

I’m running a Bokeh app as shown in and want to use an authentication hook with it, as shown here. How can I provide the authentication hook directly to the server in the code, rather than specify it in the command line?

You will need to pass an auth_provider param to `Server. The Bokeh server application itself does it this way:

auth_module_path = <path to>
if auth_module_path:
    server_kwargs['auth_provider'] = AuthModule(auth_module_path)

You could also use AuthModule to load separate file, or you could just implement your own subclass of AuthProvider directly.

Also, as a courtesy, please state up front that you are cross-posting questions in other forums, and link to the other questions. Would appreciate as well if you now self-answer (or delete) the question here.

Thanks Bryan! I self-answered the post. Will keep that in mind for the future.

1 Like