N
N
Nube2018-02-04 19:54:46
PostgreSQL
Nube, 2018-02-04 19:54:46

How to organize authorization in PostgreSQL database?

You need to do authorization, because I'm a noob, I think like this: first you need to find an entry with email in the database, then check if email has the same password. If there is an easier way, please write, you can use a link or a general algorithm. Thank you! I study GO, so I devote more time to reading about GO than working with the database, and hence such questions.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
RidgeA, 2018-02-04
@RidgeA

Yes exactly. Just store the password as a hash of some kind.
About oauth2 - the suggestion is good, but this is later, while you try to do this, otherwise it will seem that some kind of magic is happening.

A
Alexander, 2018-02-04
@sah4ez32

I propose to consider the oAuth2.0 option
https://www.digitalocean.com/community/tutorials/a...
Here is the go implementation option
https://github.com/golang/oauth2

L
Leonid Nikolaev, 2018-02-04
@nikonor

Not at all. It will be two queries, which is not very logical.
It is necessary to take the hash of the Clint password by email in one request.
Select pwd_hash from user where upper(email) = upper($1);
And if something came back, then check it with what came from the front.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question