Answer the question
In order to leave comments, you need to log in
How to store user authorization data through a social network in the database?
Hello, a mobile application and a server part for it are being written, it is planned to enable the user to link his account through several social networks. networks right away, the question is, how is it best and most correct to store it in the database? What options do I see:
1) create several additional fields for the user in the database for each social network
2) create several additional tables for each social network and bind by user id.
Answer the question
In order to leave comments, you need to log in
We use the following table schema:
Table "public.social_account"
Column | Type | Modifiers
-------------+--------------------------------+-----------
user_id | integer | not null
network | character varying(255) | not null
external_id | character varying(255) | not null
created_at | timestamp(0) without time zone | not null
updated_at | timestamp(0) without time zone | not null
id | uuid | not null
Indexes:
"social_account_pkey" PRIMARY KEY, btree (id)
"unique_social_account" UNIQUE, btree (network, external_id)
"idx_f24d8339a76ed395" btree (user_id)
Foreign-key constraints:
"fk_f24d8339a76ed395" FOREIGN KEY (user_id) REFERENCES app_user(id) ON DELETE CASCADE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question