Add auth_more field for more authentication data needed
parent
418d4f3371
commit
adff3cc36f
|
@ -3,5 +3,6 @@ CREATE TABLE IF NOT EXISTS oauth_tokens (
|
|||
id_user INTEGER NOT NULL,
|
||||
cookie VARCHAR(64) UNIQUE NOT NULL,
|
||||
access_token VARCHAR(128) NOT NULL,
|
||||
auth_more TEXT NOT NULL,
|
||||
created_on TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
|
|
@ -53,9 +53,9 @@ else
|
|||
|
||||
# create cookie and add access_token
|
||||
$cookie = hash_hmac('sha256', $auth->access_token.$id_user, 'session');
|
||||
$sm = $db->prepare('INSERT INTO oauth_tokens (id_user, cookie, access_token) VALUES (?, ?, ?)');
|
||||
$sm = $db->prepare('INSERT INTO oauth_tokens (id_user, cookie, access_token, auth_more) VALUES (?, ?, ?, ?)');
|
||||
try {
|
||||
$sm->execute([$id_user, $cookie, $auth->access_token]);
|
||||
$sm->execute([$id_user, $cookie, $auth->access_token, json_encode($payload->result)]);
|
||||
} catch (PDOException $e) {
|
||||
# TODO: log error
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue