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

feat(core): add social identity #6703

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wangsijie
Copy link
Contributor

Summary

Implement linking new social identities in profile API.

Steps to link a new social identity:

  1. Verify permission, by password or existing phone/email
  2. Call POST /verificiations/social to create a record and get authorizationUri
  3. Redirect to it and perform social provider auth.
  4. Redirect back to the front end (a callback page is required) and get callback data
  5. Call POST /verifications/social/verify with the connector data to verify
  6. Use the 2 verification record ids to link.

This PR also add some changes to SocialVerification, it no longer relys on "interaction session".

Testing

Integration tests.

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copy link

COMPARE TO master

Total Size Diff ⚠️ 📈 +15.92 KB

Diff by File
Name Diff
packages/core/src/libraries/user.ts 📈 +284 Bytes
packages/core/src/routes/experience/classes/verifications/social-verification.ts 📈 +676 Bytes
packages/core/src/routes/interaction/utils/social-verification.ts 📈 +558 Bytes
packages/core/src/routes/profile/index.openapi.json 📈 +1.04 KB
packages/core/src/routes/profile/index.ts 📈 +1.59 KB
packages/core/src/routes/verification/index.openapi.json 📈 +3.07 KB
packages/core/src/routes/verification/index.ts 📈 +2.04 KB
packages/integration-tests/src/api/profile.ts 📈 +257 Bytes
packages/integration-tests/src/api/verification-record.ts 📈 +801 Bytes
packages/integration-tests/src/tests/api/profile/social.test.ts 📈 +5.66 KB

@wangsijie wangsijie force-pushed the wangsijie-log-9892-link-new-social-identity branch from 6ed9c2e to bec3a7f Compare October 21, 2024 12:30
payload: SocialAuthorizationUrlPayload,
{
setSession,
jti,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a different name? Just to better distinguish with interaction jti.

Comment on lines +126 to +131
{
setSession: async (connectorSession) => {
this.connectorSession = connectorSession;
},
jti: this.id,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to create separate social createSocialAuthorizationUrl and verifySocialIdentity methods without the dependency on the interaction session? So we can keep the flow isolated.

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

Successfully merging this pull request may close these issues.

2 participants