diff --git a/examples/with-thirdpartypasswordless-electron/.env.example b/examples/with-thirdpartypasswordless-electron/.env.example deleted file mode 100644 index 10c102607..000000000 --- a/examples/with-thirdpartypasswordless-electron/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -NODEMAILER_USER= -NODEMAILER_PASSWORD= \ No newline at end of file diff --git a/examples/with-thirdpartypasswordless-electron/README.md b/examples/with-thirdpartypasswordless-electron/README.md index 957753d59..3542e506f 100644 --- a/examples/with-thirdpartypasswordless-electron/README.md +++ b/examples/with-thirdpartypasswordless-electron/README.md @@ -19,20 +19,6 @@ cd supertokens-auth-react/examples/with-thirdpartypasswordless-electron npm install ``` -## Set environment variables - -The demo app contains code for seding emails to the user for passwordless auth. You need to set the following environment variables for the email user before running the demo app: - -```bash -NODEMAILER_USER -NODEMAILER_PASSWORD -``` - -You can do this by: - -- Editing the `.env.example` file -- Rename the `.env.example` file to `.env` - ## Run the demo app This compiles and serves the Electron app and starts the backend API server on port 3001. diff --git a/examples/with-thirdpartypasswordless-electron/src/renderer.tsx b/examples/with-thirdpartypasswordless-electron/src/renderer.tsx index d464c7e7e..7a00291f2 100644 --- a/examples/with-thirdpartypasswordless-electron/src/renderer.tsx +++ b/examples/with-thirdpartypasswordless-electron/src/renderer.tsx @@ -77,12 +77,21 @@ SuperTokens.init({ functions: (oI) => { return { ...oI, - getAuthorisationURLFromBackend: async (input) => { + getThirdPartyAuthorisationURLWithQueryParamsAndSetState: async (input) => { + /** + * + * We override the frontendRedirectURI here because + * we have a custom API on the backend which will handle the callback + * from the provider and redirect to the electronapp via a deep link. + * So from the point of view of the provider, the frontend that it + * needs to redirect to is that custom API, which is in the API layer. + * + */ input = { ...input, - redirectURIOnProviderDashboard: getApiDomain() + "/auth/callback/" + input.thirdPartyId, + frontendRedirectURI: getApiDomain() + "/auth/callback/" + input.thirdPartyId, }; - return oI.getAuthorisationURLFromBackend(input); + return oI.getThirdPartyAuthorisationURLWithQueryParamsAndSetState(input); }, }; },