-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from waleedkadous/feature/api-v2/refresh-tokens
Introducing Refresh Tokens with Rotation for a Seamless User Experience
- Loading branch information
Showing
5 changed files
with
217 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
BEGIN; | ||
ALTER TABLE user_tokens DROP CONSTRAINT user_tokens_pkey; | ||
ALTER TABLE user_tokens ALTER COLUMN user_id DROP DEFAULT; | ||
ALTER TABLE user_tokens ALTER COLUMN user_id SET NOT NULL; | ||
ALTER TABLE user_tokens RENAME TO access_tokens; | ||
ALTER TABLE access_tokens ADD CONSTRAINT access_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; | ||
ALTER TABLE access_tokens ADD COLUMN id SERIAL PRIMARY KEY; | ||
COMMIT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TABLE refresh_tokens ( | ||
id SERIAL PRIMARY KEY, | ||
access_token_id INTEGER NOT NULL, | ||
user_id INTEGER NOT NULL, | ||
token VARCHAR(255) NOT NULL, | ||
FOREIGN KEY (user_id) REFERENCES users(id), | ||
FOREIGN KEY (access_token_id) REFERENCES access_tokens(id) ON DELETE CASCADE | ||
); |
Oops, something went wrong.