-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: account-linking initial changes * feat: add translations + initial account linking tests * test: add tests where the provider list doesn't match on the FE and BE * test: add account-linking e2e tests * fix: password reset not allowed error message * test: update tests for account-linking * docs: add account-linking example * feat: updated error codes/messages and related tests * fix: remove unneccessary fields from PASSWORD_RESET_SUCCESSFUL and submitNewPassword return types * test: making tests backwards compatible * chore: update changelog * docs(example): small simplifiactions to account linking example * docs(examples): with-account-linking docs/small simplifications * feat: remove EMAIL_ALREADY_USED_IN_ANOTHER_ACCOUNT + update version number * feat: add user to success redirection CB and matching node/web-js changes * docs: add missing translation keys and changelog * refactor: some cleanup and tests updates * test: update test server to better handle in-memory tests * chore: extended changelog * test: make tests more backwards compatible * test: fix tests * test: update test server * test: fix after cb in case whole suite was skipped * docs: update examples * chore: update changelog + implement review comments * chore: add other BE sdks to multitenancy changelog * chore: update web-js dep version to a branch + rebuild
- Loading branch information
Showing
162 changed files
with
5,126 additions
and
3,475 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
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 |
---|---|---|
@@ -1 +1,65 @@ | ||
# Account linking is not supported yet, we are actively working on the feature. | ||
![SuperTokens banner](https://raw.githubusercontent.com/supertokens/supertokens-logo/master/images/Artboard%20%E2%80%93%2027%402x.png) | ||
|
||
# SuperTokens Google one tap Demo app | ||
|
||
This demo app demonstrates the following use cases: | ||
|
||
- Thirdparty Login / Sign-up | ||
- Email Password Login / Sign-up | ||
- Logout | ||
- Session management & Calling APIs | ||
- Account linking | ||
|
||
## Project setup | ||
|
||
Clone the repo, enter the directory, and use `npm` to install the project dependencies: | ||
|
||
```bash | ||
git clone https://github.com/supertokens/supertokens-auth-react | ||
cd supertokens-auth-react/examples/with-account-linking | ||
npm install | ||
cd frontend && npm install && cd ../ | ||
cd backend && npm install && cd ../ | ||
``` | ||
|
||
## Run the demo app | ||
|
||
This compiles and serves the React app and starts the backend API server on port 3001. | ||
|
||
```bash | ||
npm run start | ||
``` | ||
|
||
The app will start on `http://localhost:3000` | ||
|
||
## How it works | ||
|
||
We are adding a new (`/link`) page where the user can add new login methods to their current user, plus enabling automatic account linking. | ||
|
||
### On the frontend | ||
|
||
The demo uses the pre-built UI, but you can always build your own UI instead. | ||
|
||
- We do not need any extra configuration to enable account linking | ||
- To enable manual linking through a custom callback page, we add `getRedirectURL` to the configuration of the social login providers. | ||
- We add a custom page (`/link`) that will: | ||
- Get and show the login methods belonging to the current user | ||
- Show a password form (if available) that calls `/addPassword` to add an email+password login method to the current user. | ||
- Show a phone number form (if available) that calls `/addPhoneNumber` to associate a phone number with the current user. | ||
- Show an "Add Google account" that start a login process through Google | ||
- We add a custom page (`/link/tpcallback/:thirdPartyId`) that will: | ||
- Call `/addThirdPartyUser` through a customized `ThirdPartyEmailPassword.thirdPartySignInAndUp` call | ||
|
||
### On the backend | ||
|
||
- We enable account linking by initializing the recipe and providing a `shouldDoAutomaticAccountLinking` implementation | ||
- We add `/addPassword`, `/addPhoneNumber` and `/addThirdPartyUser` to enable manual linking from the frontend | ||
- We add `/userInfo` so the frontend can list/show the login methods belonging to the current user. | ||
|
||
## Author | ||
|
||
Created with :heart: by the folks at supertokens.com. | ||
|
||
## License | ||
|
||
This project is licensed under the Apache 2.0 license. |
Oops, something went wrong.