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

Two questions about SocialAuthentication #99

Closed
JoeCotellese opened this issue Apr 14, 2018 · 1 comment
Closed

Two questions about SocialAuthentication #99

JoeCotellese opened this issue Apr 14, 2018 · 1 comment

Comments

@JoeCotellese
Copy link

I have a couple of questions here.

The SocialAuthenticator examples show stashing the Social ID in the user model. Is that just for illustrative purposes or does that really makes sense from a modeling perspective? It seems like it might make more sense to have another table to make it easier to connect multiple social accounts.

The second question is where should I store the auth token? Should I store it in my User Model?

@weaverryan
Copy link
Member

Hey @JoeCotellese!

The SocialAuthenticator examples show stashing the Social ID in the user model. Is that just for illustrative purposes or does that really makes sense from a modeling perspective? It seems like it might make more sense to have another table to make it easier to connect multiple social accounts.

I think it's ok to do it either way, but I prefer right on the model, it's simpler. We actually have things like facebookId, twitterId, etc on our User class for KnpU. If we need to reference the Twitter ID specifically, we know exactly where it is.

The second question is where should I store the auth token? Should I store it in my User Model?

Good question. Maybe nowhere :). If all you want to do is make an immediate request for some data, then make that request, and don't store the token anywhere. If you want to do some offline processing or make API calls later, you'll need to store it. But, tokens are temporary, so you may need to also fetch and save a refresh token (and some systems don't even have that). So, it depends on your use-case - we don't store them anywhere for KnpU.

Cheers!

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

No branches or pull requests

2 participants