How to get the logged in user info

Did you try change to session time

i think setting a cookie session is better option.
how can i set cookie session on server actions? i can set sessions but there is no option to set cookies

so adding security provider then getting the identity output give me the login name

Did you watch this video ?

1 Like

Nope
Thanks @s.alpaslan :slightly_smiling_face:

Please check the following tutorial: https://github.com/Wappler/docs/wiki/Getting-Logged-User-Details
Also in security provider options you can set the cookie lifetime.

1 Like

yea i was talking about sessions life time not cookies

Just setup the cookie lifetime in security provider options … nothing else is required!

sessions @Teodor not cookies
like this one $_SESSION['var']

What are you trying to achieve exactly?

i was redoing what the security provider was doing for me.from the start :slightly_smiling_face:
so im good now all is working great.

You can access the session created after log in doing the following:
The session name is the security provider step name+Id.
For example if your security provider step name is “loggedUser” then the session name is “loggedUserId”.

1 Like

I don t understand where to look for the providerstep + id. I always user Identity.

I am not sure I understand your post, also I am not sure you understand what I explained exactly. Can you please clarify what do you mean?

I do not understand what you refer here.

When the user logs in, the security provider creates a session variable which value is the logged user identity. If you, for some strange reason, need to access it, it can be accessed like:

The session name is the security provider step name+Id.
For example if your security provider step name is “loggedUser” then the session name is “loggedUserId”.

If you don’t know what I am referring to, then maybe you just don’t need to use this (as most of the users here don’t really need this session).

For sure I will not use. I m too basic! Thank you very much I was supposig was another method alternative to using the Identity variabile.

There are some users, which need this session in external PHP scripts, that’s why I provided this information.
When using the security provider with server/app connect you just won’t need this :slight_smile:

1 Like

Accessing the ID of the current user is now documented here.

Yes, that’s useful for scripts outside of server connect.
Inside server connect, this is returned by the security provider step, so when you include it in the steps, you have the logged user ID.