Creepwood
12/25/2022, 12:38 PMrp
12/25/2022, 12:40 PMCreepwood
12/26/2022, 10:50 AMrp
12/26/2022, 11:32 AMadd_roles_and_permissions_to_session
function).
The session can be accessed via the response.session
object.
Finally, I think you also need to add await
in front of add_role_to_user_func
.Creepwood
12/26/2022, 12:51 PMadd_roles_and_permissions_to_session
did it! But i definitely struggling with asyncio... I think it is not possible to run a second async function in the sign_up_post override.
It end up in: raise RuntimeError('This event loop is already running')
And add_role_to_user()
from "supertokens_python.recipe.userroles.asyncio import add_role_to_user" can not be awaited?
After adding import nest_asyncio
and calling nest_asyncio.apply()
it worked this way:rp
12/26/2022, 1:00 PMKShivendu
12/26/2022, 1:10 PMawait
.
python
async def add_role_to_user_func(user_id: str, role: str):
res = await add_role_to_user(user_id, role)
Also, I didn't get any error. It's working fine for me. Can you please tell more about which framework are you using and how are you running it?Creepwood
12/26/2022, 1:37 PMnest_asyncio
?nest_asyncio
KShivendu
12/27/2022, 5:03 AMnest_asyncio
when doing python app.py
(Flask)gunicorn --bind 0.0.0.0:3001 app:app
as well.Creepwood
12/27/2022, 8:09 PMKShivendu
12/28/2022, 5:30 AMCreepwood
12/28/2022, 12:46 PMKShivendu
12/28/2022, 1:06 PMCreepwood
12/29/2022, 9:25 AMKShivendu
12/29/2022, 9:34 AMCreepwood
12/29/2022, 9:35 AMKShivendu
12/29/2022, 9:36 AM