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

Make custom query for authentication #1124

Merged
merged 12 commits into from
Jan 6, 2019
Merged

Make custom query for authentication #1124

merged 12 commits into from
Jan 6, 2019

Conversation

saiichihashimoto
Copy link
Contributor

The current OAuth implementations will update an existing user if it finds one. Great! However, it will only find an existing user if they've authenticated with that specific OAuth provider. But we can give the user the ability determine what an existing user means.

For example:

function makeQuery(profile, options) {
  return {
    $or: [
      { [options.idField]: profile.id },
      { email: profile.email },
    ],
  };
}

Now, it would also find users that have the same email, meaning it would link together accounts! Very cool! 👍

@saiichihashimoto saiichihashimoto changed the title Saiichihashimoto/make query Make custom query for authenticatino Dec 6, 2018
@saiichihashimoto saiichihashimoto changed the title Make custom query for authenticatino Make custom query for authentication Dec 6, 2018
@saiichihashimoto
Copy link
Contributor Author

@daffl, I'm not sure what the process is for things like this, so let me know what I need to do. 👍

@daffl
Copy link
Member

daffl commented Jan 2, 2019

Thank you for the pull request! I think it makes sense to add this but we do need tests and updated documentation otherwise nobody will know about it and we don't know if it works 😄

@saiichihashimoto
Copy link
Contributor Author

@daffl sounds good, I'll get to that later today! Is the function signature of makeQuery OK?

@saiichihashimoto
Copy link
Contributor Author

saiichihashimoto commented Jan 5, 2019

@daffl, I wrote some basic tests to see if the query is being called. Docs changes in feathersjs-ecosystem/docs#1246

@daffl daffl merged commit 5d43e3c into feathersjs:master Jan 6, 2019
@daffl
Copy link
Member

daffl commented Jan 6, 2019

Great, thank you! Released as @feathersjs/authentication-oauth1@1.1.0 and @feathersjs/authentication-oauth2@1.3.0

@saiichihashimoto saiichihashimoto deleted the saiichihashimoto/make-query branch January 6, 2019 20:16
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 this pull request may close these issues.

2 participants