diff --git a/.github/workflows/auth-react-test-1-django.yml b/.github/workflows/auth-react-test-1-django.yml index ad74b1bcc..3f4a1fb11 100644 --- a/.github/workflows/auth-react-test-1-django.yml +++ b/.github/workflows/auth-react-test-1-django.yml @@ -23,6 +23,8 @@ jobs: fdiVersions: ${{ steps.versions.outputs.fdiVersions }} cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.13"]' + nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }} + authReactFdiVersionMap: ${{ steps.auth-react-versions.outputs.fdiVersions }} steps: - uses: actions/checkout@v4 @@ -32,6 +34,20 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: auth-react-versions + with: + repo: supertokens-auth-react + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + + - uses: supertokens/actions/get-versions-from-repo@main + id: node-versions + with: + repo: supertokens-node + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + setup-auth-react: runs-on: ubuntu-latest needs: define-versions @@ -51,19 +67,20 @@ jobs: matrix: ${{ steps.setup-matrix.outputs.matrix }} steps: - - uses: supertokens/get-versions-action@main + - name: Get node and auth-react versions for FDI id: versions - with: - driver-name: python - fdi-version: ${{ matrix.fdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + run: | + nodeVersion=$( echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + authReactVersion=$( echo '${{ needs.define-versions.outputs.authReactFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + + echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT + echo "authReactVersion=${authReactVersion}" >> $GITHUB_OUTPUT - uses: supertokens/auth-react-testing-action/setup@main id: envs with: - auth-react-version: ${{ steps.versions.outputs.authReactVersionXy }} - node-sdk-version: ${{ steps.versions.outputs.nodeTag }} + auth-react-version: ${{ steps.versions.outputs.authReactVersion }} + node-sdk-version: ${{ steps.versions.outputs.nodeVersion }} fdi-version: ${{ matrix.fdi-version }} - id: setup-matrix diff --git a/.github/workflows/auth-react-test-1-fastapi.yml b/.github/workflows/auth-react-test-1-fastapi.yml index 5f0e08cc9..1afba68a3 100644 --- a/.github/workflows/auth-react-test-1-fastapi.yml +++ b/.github/workflows/auth-react-test-1-fastapi.yml @@ -23,6 +23,8 @@ jobs: fdiVersions: ${{ steps.versions.outputs.fdiVersions }} cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.13"]' + nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }} + authReactFdiVersionMap: ${{ steps.auth-react-versions.outputs.fdiVersions }} steps: - uses: actions/checkout@v4 @@ -32,6 +34,20 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: auth-react-versions + with: + repo: supertokens-auth-react + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + + - uses: supertokens/actions/get-versions-from-repo@main + id: node-versions + with: + repo: supertokens-node + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + setup-auth-react: runs-on: ubuntu-latest needs: define-versions @@ -51,19 +67,20 @@ jobs: matrix: ${{ steps.setup-matrix.outputs.matrix }} steps: - - uses: supertokens/get-versions-action@main + - name: Get node and auth-react versions for FDI id: versions - with: - driver-name: python - fdi-version: ${{ matrix.fdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + run: | + nodeVersion=$( echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + authReactVersion=$( echo '${{ needs.define-versions.outputs.authReactFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + + echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT + echo "authReactVersion=${authReactVersion}" >> $GITHUB_OUTPUT - uses: supertokens/auth-react-testing-action/setup@main id: envs with: - auth-react-version: ${{ steps.versions.outputs.authReactVersionXy }} - node-sdk-version: ${{ steps.versions.outputs.nodeTag }} + auth-react-version: ${{ steps.versions.outputs.authReactVersion }} + node-sdk-version: ${{ steps.versions.outputs.nodeVersion }} fdi-version: ${{ matrix.fdi-version }} - id: setup-matrix diff --git a/.github/workflows/auth-react-test-1-flask.yml b/.github/workflows/auth-react-test-1-flask.yml index 991381bb7..241945588 100644 --- a/.github/workflows/auth-react-test-1-flask.yml +++ b/.github/workflows/auth-react-test-1-flask.yml @@ -23,6 +23,8 @@ jobs: fdiVersions: ${{ steps.versions.outputs.fdiVersions }} cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.13"]' + nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }} + authReactFdiVersionMap: ${{ steps.auth-react-versions.outputs.fdiVersions }} steps: - uses: actions/checkout@v4 @@ -32,6 +34,20 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: auth-react-versions + with: + repo: supertokens-auth-react + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + + - uses: supertokens/actions/get-versions-from-repo@main + id: node-versions + with: + repo: supertokens-node + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + setup-auth-react: runs-on: ubuntu-latest needs: define-versions @@ -51,19 +67,20 @@ jobs: matrix: ${{ steps.setup-matrix.outputs.matrix }} steps: - - uses: supertokens/get-versions-action@main + - name: Get node and auth-react versions for FDI id: versions - with: - driver-name: python - fdi-version: ${{ matrix.fdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + run: | + nodeVersion=$( echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + authReactVersion=$( echo '${{ needs.define-versions.outputs.authReactFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' ) + + echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT + echo "authReactVersion=${authReactVersion}" >> $GITHUB_OUTPUT - uses: supertokens/auth-react-testing-action/setup@main id: envs with: - auth-react-version: ${{ steps.versions.outputs.authReactVersionXy }} - node-sdk-version: ${{ steps.versions.outputs.nodeTag }} + auth-react-version: ${{ steps.versions.outputs.authReactVersion }} + node-sdk-version: ${{ steps.versions.outputs.nodeVersion }} fdi-version: ${{ matrix.fdi-version }} - id: setup-matrix diff --git a/.github/workflows/auth-react-test-3.yml b/.github/workflows/auth-react-test-3.yml index 23a5b108d..0736f1d78 100644 --- a/.github/workflows/auth-react-test-3.yml +++ b/.github/workflows/auth-react-test-3.yml @@ -83,8 +83,32 @@ jobs: python3 -m pip install pip setuptools --upgrade make dev-install && rm -rf src + - name: Get supported Python CDI versions + id: cdi-versions + uses: supertokens/get-supported-versions-action@main + with: + has-cdi: true + working-directory: supertokens-python + + - uses: supertokens/actions/get-versions-from-repo@main + id: core-versions + with: + repo: supertokens-core + github-token: ${{ secrets.GITHUB_TOKEN }} + cdi-versions: ${{ steps.cdi-versions.outputs.cdiVersions }} + + - name: Get core version from latest Python CDI version + id: core-version + run: | + lastPythonCdiVersion=$(echo '${{ steps.cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]' | sed -e 's/"/\\"/g') + coreVersion=$(echo '${{ steps.core-versions.outputs.cdiVersions }}' | jq -r ".[\"$lastPythonCdiVersion\"]") + + echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT + - name: Start core working-directory: supertokens-python + env: + SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }} run: docker compose up --wait - name: Start Server (django) diff --git a/.github/workflows/backend-sdk-testing.yml b/.github/workflows/backend-sdk-testing.yml index 94798d06c..41cba1724 100644 --- a/.github/workflows/backend-sdk-testing.yml +++ b/.github/workflows/backend-sdk-testing.yml @@ -24,6 +24,7 @@ jobs: cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]' nodeVersions: '["20"]' + coreCdiVersionMap: ${{ steps.core-versions.outputs.cdiVersions }} steps: - uses: actions/checkout@v4 @@ -33,6 +34,13 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: core-versions + with: + repo: supertokens-core + github-token: ${{ secrets.GITHUB_TOKEN }} + cdi-versions: ${{steps.versions.outputs.cdiVersions }} + test: runs-on: ubuntu-latest needs: define-versions @@ -56,14 +64,12 @@ jobs: # Checking out to a custom path since the test repo will also be cloned path: supertokens-python - - uses: supertokens/get-versions-action@main - id: versions - with: - driver-name: python - cdi-version: ${{ matrix.cdi-version }} - fdi-version: ${{ matrix.fdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + - name: Get core version from current CDI version + id: core-version + run: | + coreVersion=$(echo '${{ needs.define-versions.outputs.coreCdiVersionMap }}' | jq -r '.["${{ matrix.cdi-version }}"]') + + echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT - uses: actions/setup-node@v4 with: @@ -82,7 +88,7 @@ jobs: working-directory: supertokens-python env: SUPERTOKENS_ENV: testing - SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersionXy }} + SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }} run: | source venv/bin/activate docker compose up --build --wait @@ -91,6 +97,6 @@ jobs: - uses: supertokens/backend-sdk-testing-action@main with: version: ${{ matrix.fdi-version }} - check-name-suffix: '[CDI=${{ matrix.cdi-version }}][Core=${{ steps.versions.outputs.coreVersionXy }}][FDI=${{ matrix.fdi-version }}][Py=${{ matrix.py-version }}][Node=${{ matrix.node-version }}]' + check-name-suffix: '[CDI=${{ matrix.cdi-version }}][Core=${{ steps.core-version.outputs.coreVersion }}][FDI=${{ matrix.fdi-version }}][Py=${{ matrix.py-version }}][Node=${{ matrix.node-version }}]' path: backend-sdk-testing app-server-logs: ${{ github.workspace }}/supertokens-python/python.log diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a74f9ec51..5163e2c50 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -24,6 +24,7 @@ jobs: fdiVersions: ${{ steps.versions.outputs.fdiVersions }} cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]' + coreCdiVersionMap: ${{ steps.core-versions.outputs.cdiVersions }} steps: - uses: actions/checkout@v4 @@ -34,6 +35,13 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: core-versions + with: + repo: supertokens-core + github-token: ${{ secrets.GITHUB_TOKEN }} + cdi-versions: ${{steps.versions.outputs.cdiVersions }} + test: runs-on: ubuntu-latest needs: define-versions @@ -47,13 +55,12 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: supertokens/get-versions-action@main - id: versions - with: - driver-name: python - cdi-version: ${{ matrix.cdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + - name: Get core version from current CDI version + id: core-version + run: | + coreVersion=$(echo '${{ needs.define-versions.outputs.coreCdiVersionMap }}' | jq -r '.["${{ matrix.cdi-version }}"]') + + echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT - uses: actions/setup-python@v5 with: @@ -72,7 +79,7 @@ jobs: source venv/bin/activate make test env: - SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersionXy }} + SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }} - uses: pmeier/pytest-results-action@main name: Surface failing tests @@ -80,4 +87,4 @@ jobs: with: path: test-results/junit.xml summary: true - title: "[Core=${{ steps.versions.outputs.coreVersionXy }}][py=${{ matrix.py-version }}] Unit Test Results" + title: "[Core=${{ steps.core-version.outputs.coreVersion }}][py=${{ matrix.py-version }}] Unit Test Results" diff --git a/.github/workflows/website-test.yml b/.github/workflows/website-test.yml index f63530500..dfe99e5ca 100644 --- a/.github/workflows/website-test.yml +++ b/.github/workflows/website-test.yml @@ -23,6 +23,9 @@ jobs: fdiVersions: ${{ steps.versions.outputs.fdiVersions }} cdiVersions: ${{ steps.versions.outputs.cdiVersions }} pyVersions: '["3.8", "3.13"]' + nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }} + websiteFdiVersionMap: ${{ steps.website-versions.outputs.fdiVersions }} + coreCdiVersionMap: ${{ steps.core-versions.outputs.cdiVersions }} steps: - uses: actions/checkout@v4 @@ -32,6 +35,27 @@ jobs: has-fdi: true has-cdi: true + - uses: supertokens/actions/get-versions-from-repo@main + id: website-versions + with: + repo: supertokens-website + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + + - uses: supertokens/actions/get-versions-from-repo@main + id: node-versions + with: + repo: supertokens-node + github-token: ${{ secrets.GITHUB_TOKEN }} + fdi-versions: ${{ steps.versions.outputs.fdiVersions }} + + - uses: supertokens/actions/get-versions-from-repo@main + id: core-versions + with: + repo: supertokens-core + github-token: ${{ secrets.GITHUB_TOKEN }} + cdi-versions: ${{steps.versions.outputs.cdiVersions }} + test: runs-on: ubuntu-latest needs: define-versions @@ -67,16 +91,22 @@ jobs: with: python-version: ${{ matrix.py-version }} - - uses: supertokens/get-versions-action@main + - name: Get versions from current FDI/CDI version id: versions - with: - driver-name: python - fdi-version: ${{ matrix.fdi-version }} - env: - SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }} + run: | + latestCdiVersion=$(echo '${{ needs.define-versions.outputs.cdiVersions }}' | jq -r '.[-1]' | sed -e 's/"/\\"/g') + coreVersion=$(echo '${{ needs.define-versions.outputs.coreCdiVersionMap }}' | jq -r ".[\"$latestCdiVersion\"]") + nodeVersion=$(echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]') + websiteVersion=$(echo '${{ needs.define-versions.outputs.websiteFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]') + + echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT + echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT + echo "websiteVersion=${websiteVersion}" >> $GITHUB_OUTPUT - name: Start core working-directory: supertokens-python + env: + SUPERTOKENS_CORE_VERSION: ${{ steps.versions.outputs.coreVersion }} run: docker compose up --wait - name: Setup venv @@ -185,8 +215,8 @@ jobs: - uses: supertokens/website-testing-action@main with: - version: ${{ steps.versions.outputs.frontendVersionXy }} - node-sdk-version: ${{ steps.versions.outputs.nodeTag }} + version: ${{ steps.versions.outputs.websiteVersion }} + node-sdk-version: ${{ steps.versions.outputs.nodeVersion }} path: supertokens-website check-name-suffix: '[Py=${{ matrix.py-version }}][FDI=${{ matrix.fdi-version }}][Framework=${{ matrix.framework }}]' app-server-logs: ${{ steps.envs.outputs.APP_SERVER_LOG_DIR }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 4522215ce..c89d800eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [0.30.3] - 2025-08-28 +- Fixes webauthn MFA integration + ## [0.30.2] - 2025-08-14 - Adds Webauthn user editing support to the Dashboard diff --git a/compose.yml b/compose.yml index 114e5e0e5..f15ee2466 100644 --- a/compose.yml +++ b/compose.yml @@ -1,7 +1,12 @@ services: core: # Uses `$SUPERTOKENS_CORE_VERSION` when available, else latest - image: supertokens/supertokens-core:dev-branch-${SUPERTOKENS_CORE_VERSION:-master} + image: supertokens/supertokens-dev-postgresql:${SUPERTOKENS_CORE_VERSION:-master} + entrypoint: [ + "/usr/lib/supertokens/jre/bin/java", + "-classpath", "/usr/lib/supertokens/core/*:/usr/lib/supertokens/plugin-interface/*:/usr/lib/supertokens/ee/*", + "io.supertokens.Main", "/usr/lib/supertokens/", "DEV", "test_mode" + ] ports: # Uses `$SUPERTOKENS_CORE_PORT` when available, else 3567 for local port - ${SUPERTOKENS_CORE_PORT:-3567}:3567 diff --git a/setup.py b/setup.py index 7c74eb247..d9e9dbfa2 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ setup( name="supertokens_python", - version="0.30.2", + version="0.30.3", author="SuperTokens", license="Apache 2.0", author_email="team@supertokens.com", diff --git a/supertokens_python/constants.py b/supertokens_python/constants.py index 1010900ea..562058a04 100644 --- a/supertokens_python/constants.py +++ b/supertokens_python/constants.py @@ -15,7 +15,7 @@ from __future__ import annotations SUPPORTED_CDI_VERSIONS = ["5.3"] -VERSION = "0.30.2" +VERSION = "0.30.3" TELEMETRY = "/telemetry" USER_COUNT = "/users/count" USER_DELETE = "/user/remove" diff --git a/supertokens_python/recipe/webauthn/recipe.py b/supertokens_python/recipe/webauthn/recipe.py index 02465285b..86b9c365c 100644 --- a/supertokens_python/recipe/webauthn/recipe.py +++ b/supertokens_python/recipe/webauthn/recipe.py @@ -132,7 +132,7 @@ def callback(): async def get_available_secondary_factor_ids( _: TenantConfig, ) -> List[str]: - return ["emailpassword"] + return [FactorIds.WEBAUTHN] mfa_instance.add_func_to_get_all_available_secondary_factor_ids_from_other_recipes( GetAllAvailableSecondaryFactorIdsFromOtherRecipesFunc( @@ -143,11 +143,11 @@ async def get_available_secondary_factor_ids( async def user_setup(user: User, _: Dict[str, Any]) -> List[str]: for login_method in user.login_methods: # We don't check for tenantId here because if we find the user - # with emailpassword loginMethod from different tenant, then + # with webauthn loginMethod from different tenant, then # we assume the factor is setup for this user. And as part of factor # completion, we associate that loginMethod with the session's tenantId if login_method.recipe_id == self.recipe_id: - return ["emailpassword"] + return [FactorIds.WEBAUTHN] return [] @@ -174,7 +174,8 @@ async def get_emails_for_factor( # We order the login methods based on `time_joined` (oldest first) ordered_login_methods = sorted( - user.login_methods, key=lambda lm: lm.time_joined, reverse=True + user.login_methods, + key=lambda lm: lm.time_joined, ) # We take the ones that belong to this recipe recipe_ordered_login_methods = list( @@ -185,7 +186,7 @@ async def get_emails_for_factor( ) result: List[str] = [] - if len(recipe_ordered_login_methods) == 0: + if len(recipe_ordered_login_methods) != 0: # If there are login methods belonging to this recipe, the factor is set up # In this case we only list email addresses that have a password associated with them @@ -234,14 +235,14 @@ async def get_emails_for_factor( # If there is at least one real email address linked to the user, we only suggest real addresses result = [ lm.email - for lm in recipe_ordered_login_methods + for lm in ordered_login_methods if lm.email is not None and not is_fake_email(lm.email) ] else: # Else we use the fake ones result = [ lm.email - for lm in recipe_ordered_login_methods + for lm in ordered_login_methods if lm.email is not None and is_fake_email(lm.email) ] @@ -264,17 +265,8 @@ async def get_emails_for_factor( if email != session_login_method.email ] - # If the list is empty we generate an email address to make the flow where the user is never asked for - # an email address easier to implement. In many cases when the user adds an email-password factor, they - # actually only want to add a password and do not care about the associated email address. - # Custom implementations can choose to ignore this, and ask the user for the email anyway. - if len(result) == 0: - result.append( - f"{session_recipe_user_id.get_as_string()}@stfakeemail.supertokens.com" - ) - return GetEmailsForFactorOkResult( - factor_id_to_emails_map={"emailpassword": result} + factor_id_to_emails_map={FactorIds.WEBAUTHN: result} ) mfa_instance.add_func_to_get_emails_for_factor_from_other_recipes(