Retrieve the state param (Chainlit + Azure auth + passing params to webapp)
Hi.
I'm trying to integrate the Azure authentication in my code but I have problems retrieving the state param of the MS login auth.
The idea was to call the chainlit webapp and to pass it some parameters via the url in this way:
www.mydomain.com/?arg1=<value>
but it turn out this is not really a feasible way because it would mean using wildcards in the redirected url which compromises security.
As described in the (MS documentation) the preferred way is to pass any type of custom argument via a state param.
How would I retrieve this state param from the chainlit side? I did explore the server.py file and it seems the state param is set on random, which I suppose makes it impossible for us to retrieve it using the chainlit API (?).
Please if you have any idea to solve this let me know.
PS: please let me know if there's any way to pass parameters to the chainlit webapp which are not mentioned above I am not aware of. Maybe there's an easier way to do this which does not involve the authentication process?
@martrdev do you solved?
Hi @puppetm4st3r sorry for replying after so long.
To answer your question: sort of.. I've adopted the method of closing and relaunching the app. 😅
The solution is far from perfect but basically I've used the traditional method without any fancy solution (state parameters or wildcards) but with a little trick.
When the app gets lauched the first time, after you login the url will be without any param, e.g. www.mydomain.com.
At that point you can close it and relaunch it. Because of the fact that you are already logged in, this will not trigger the login step, hence the url will keep the parameters, e.g. www.mydomain.com/?arg1=<value>.
It's not elegant, I know, but it was the quickest thing I could think of. And in my case it works pretty well because in order to launch my app, the users have to access a software with their MS credentials, which basically makes it very rare for the auth to be triggered when the app is launched (also, you can just address this in the README button).
I hope I have been clear with my explanation!😅
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.