Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store access tokens as a post type #215

Open
spacedmonkey opened this issue Jun 18, 2018 · 2 comments · May be fixed by #216
Open

Store access tokens as a post type #215

spacedmonkey opened this issue Jun 18, 2018 · 2 comments · May be fixed by #216

Comments

@spacedmonkey
Copy link
Collaborator

Currently user access tokens are stored as an option. This has a number of down sides, includes

  • Extremely hard to query, with for all or by user
  • Options table is not designed to scale to millions of rows.
  • Access tokens are not directly linked to users and are not deleted when user accounts for removed.

Making the access token a post type, fixes all these issues.

@spacedmonkey spacedmonkey linked a pull request Jun 18, 2018 that will close this issue
@kosso
Copy link
Contributor

kosso commented Jun 18, 2018

Don't forget to handle the expiry of the token.

(Does this plugin handle that yet? Last time I looked, the database was getting clogged up with loads of them)

I also agree that options are not a good place to store these.

But wouldn't a user meta field be a better fit than a post type?

@spacedmonkey
Copy link
Collaborator Author

@kosso I have answered the question of using user meta in the PR, if you want to take a look over the for an answer.

As for expiring tokens, I am not sure that this is handled yet, or not at least I can see. If the token was a post, then we could use the post created date and sheduled event to clean out expired tokens.

The nice thing about storing is as post, is that once a user is deleted, the token does with it. So that should mean less useless token in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants