C
C
Cat_usual2019-08-31 17:18:18
MySQL
Cat_usual, 2019-08-31 17:18:18

What is the best way to write user_id in Cookie?

I have a database and it has a user_id line
And it is written in Cookies, that is, it determines whether a person is authorized or not. But I still need a user_id to access the Database through it, and if a person changes the user_id in Cookies, what should I do then?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Ivanov, 2019-08-31
@Cat_usual

Either sign the cookie or store the user_id in the session.
Well, use httpOnly for this cookie

A
Anton R., 2019-08-31
@anton_reut

Everything related to authorization should use sessions and not cookies.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question