i was wondering if there was a way to add stuff to...
# support-questions-legacy
f
i was wondering if there was a way to add stuff to to a users details using django serializers and all
r
Hey! We have the user metadata recipe. Maybe that helps?
f
oh ok!
imma check it out
thx
could you drop a link?
f
thanks very much
but one more question
in this photo
could you explain the user_id variable?
r
it's a string that's the ID for the metadata. Normally this would be the user's ID against whom you want to store the metadata, but technically, it could be any ID
f
like say the email?
they used to sign in?
r
it can be. But it's better to just use their userID instead
since they can change their email
f
ohhh👍🏾
sooooo
user_id = “their user id”😅
r
yes
f
you’re too kind
tnx
r
thanks!
f
what if i’m not trying to manipulate data for a specific user?
like if a user does something, their data changes
how would i get userID then?
r
lots of ways.. from their session for example
f
can you show me a demonstration?
r
i would suggest that you search for this in the docs. Your request is quite vague.
f
🙈
tnx again
Copy code
from supertokens_python.recipe.session.framework.django.asyncio import verify_session
from supertokens_python.recipe.thirdpartyemailpassword.asyncio import get_user_by_id
from django.http import HttpRequest
from supertokens_python.recipe.session import SessionContainer

@verify_session()
async def get_user_info_api(request: HttpRequest):
    session: SessionContainer = request.supertokens 

    user_id = session.get_user_id()

    # You can learn more about the `User` object over here https://github.com/supertokens/core-driver-interface/wiki
    _ = await get_user_by_id(user_id)
session.get_user_id()
👍
r
yes!