-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add shouldTryLinkingWithSessionUser flag to auth apis and make …
…overwriteSessionDuringSignInUp deafult to true (#909) * feat: add shouldTryLinkingWithSessionUser flag * feat: add tryLinkingWithSessionUser, forceFreshAuth and small test fixes * fix: test server compatible with 1.17/2.0 (#897) * fix: test server compatible with 1.17 * fix: pr comments * fix: mfa claim * fix: version and changelog * fix: using version function for comparision * fix: circle ci scripts * fix: circle ci testing * fix: circle ci testing * fix: circle ci testing * fix: test server * fix: circle ci restore * adding dev-v20.0.1 tag to this commit to ensure building * fix: config (#905) * adding dev-v20.0.1 tag to this commit to ensure building * feat: prompt param fixing * refactors an exception case * feat: validate max_age * fix: make shouldDoAutomaticAccountLinking properly get the primary user when linking to oldest user (#907) * adding dev-v20.0.2 tag to this commit to ensure building * feat: make shouldTryLinkingWithSessionUser optional in FDI3.1 * feat: fix tryLinkingImplementation and change degault for overwriteSessionDuringSignInUp --------- Co-authored-by: Sattvik Chakravarthy <[email protected]> Co-authored-by: Sattvik Chakravarthy <[email protected]> Co-authored-by: rishabhpoddar <[email protected]>
- Loading branch information
1 parent
6f45c5f
commit 905b5cd
Showing
150 changed files
with
1,129 additions
and
640 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
echo "Starting tests for CDI $1"; | ||
|
||
if [ -z "$SUPERTOKENS_API_KEY" ]; then | ||
echo "SUPERTOKENS_API_KEY not set" | ||
exit 1 | ||
fi | ||
|
||
coreDriverVersion=$1 | ||
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` | ||
|
||
frontendDriverVersion=$2 | ||
|
||
coreFree=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ | ||
-H 'api-version: 1'` | ||
if [[ `echo $coreFree | jq .core` == "null" ]] | ||
then | ||
echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." | ||
exit 1 | ||
fi | ||
coreFree=$(echo $coreFree | jq .core | tr -d '"') | ||
|
||
cd .. | ||
./test/testExports.sh | ||
if [[ $? -ne 0 ]] | ||
then | ||
echo "export test failed... exiting!" | ||
exit 1 | ||
fi | ||
cd .circleci | ||
|
||
./setupAndTestBackendSDKWithFreeCore.sh $coreFree $coreDriverVersion $frontendDriverVersion | ||
if [[ $? -ne 0 ]] | ||
then | ||
echo "test failed... exiting!" | ||
exit 1 | ||
fi | ||
rm -rf ../../supertokens-root |
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
coreInfo=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $coreInfo | jq .tag` == "null" ]] | ||
then | ||
echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" | ||
exit 1 | ||
fi | ||
coreTag=$(echo $coreInfo | jq .tag | tr -d '"') | ||
coreVersion=$(echo $coreInfo | jq .version | tr -d '"') | ||
|
||
pluginInterfaceVersionXY=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] | ||
then | ||
echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" | ||
exit 1 | ||
fi | ||
pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') | ||
|
||
pluginInterfaceInfo=`curl -s -X GET \ | ||
"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ | ||
-H 'api-version: 0'` | ||
if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] | ||
then | ||
echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" | ||
exit 1 | ||
fi | ||
pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') | ||
pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') | ||
|
||
echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" | ||
|
||
cd ../../ | ||
git clone [email protected]:supertokens/supertokens-root.git | ||
cd supertokens-root | ||
if [[ $2 == "2.0" ]] || [[ $2 == "2.1" ]] || [[ $2 == "2.2" ]] | ||
then | ||
git checkout 36e5af1b9a4e3b07247d0cf333cf82a071a78681 | ||
fi | ||
echo -e "core,$1\nplugin-interface,$pluginInterfaceVersionXY" > modules.txt | ||
./loadModules --ssh | ||
cd supertokens-core | ||
git checkout $coreTag | ||
cd ../supertokens-plugin-interface | ||
git checkout $pluginInterfaceTag | ||
cd ../ | ||
echo $SUPERTOKENS_API_KEY > apiPassword | ||
./utils/setupTestEnvLocal | ||
cd ../project/ | ||
|
||
# Set the script to exit on error | ||
set -e | ||
|
||
API_PORT=3030 | ||
ST_CONNECTION_URI=http://localhost:8081 | ||
|
||
# start test-server | ||
pushd test/test-server | ||
npm install | ||
API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI npm start & | ||
popd | ||
|
||
frontendDriverVersion=$3 | ||
# run tests | ||
cd ../ | ||
git clone [email protected]:supertokens/backend-sdk-testing.git | ||
cd backend-sdk-testing | ||
git checkout $frontendDriverVersion | ||
npm install | ||
npm run build | ||
|
||
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --node-option no-experimental-fetch -r test/fetch-polyfill.mjs --no-config --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/**/*.test.js') | ||
else | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
|
||
# kill test-server | ||
kill $(lsof -t -i:$API_PORT) |
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 |
---|---|---|
|
@@ -58,36 +58,3 @@ if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | |
else | ||
TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
|
||
API_PORT=3030 | ||
ST_CONNECTION_URI=http://localhost:8081 | ||
|
||
# start test-server | ||
pushd test/test-server | ||
npm install | ||
API_PORT=$API_PORT ST_CONNECTION_URI=$ST_CONNECTION_URI npm start & | ||
popd | ||
|
||
# lets read frontendDriverInterfaceSupported | ||
frontendDriverJson=`cat ./frontendDriverInterfaceSupported.json` | ||
# get versions | ||
frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` | ||
# use latest version | ||
frontendDriverVersion=`echo $frontendDriverArray | jq ".[-1]" | tr -d '"'` | ||
|
||
# run tests | ||
cd ../ | ||
git clone [email protected]:supertokens/backend-sdk-testing.git | ||
cd backend-sdk-testing | ||
git checkout $frontendDriverVersion | ||
npm install | ||
npm run build | ||
|
||
if ! [[ -z "${CIRCLE_NODE_TOTAL}" ]]; then | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npx mocha --node-option no-experimental-fetch -r test/fetch-polyfill.mjs --no-config --timeout 500000 $(npx mocha-split-tests -r ./runtime.log -t $CIRCLE_NODE_TOTAL -g $CIRCLE_NODE_INDEX -f 'test/**/*.test.js') | ||
else | ||
API_PORT=$API_PORT TEST_MODE=testing SUPERTOKENS_CORE_TAG=$coreTag NODE_PORT=8081 INSTALL_PATH=../supertokens-root npm test | ||
fi | ||
|
||
# kill test-server | ||
kill $(lsof -t -i:$API_PORT) |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.