Skip to content

Commit 7f017c4

Browse files
fixes electron app code (#816)
1 parent 4cfb00d commit 7f017c4

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

examples/with-thirdpartypasswordless-electron/.env.example

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/with-thirdpartypasswordless-electron/README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,6 @@ cd supertokens-auth-react/examples/with-thirdpartypasswordless-electron
1919
npm install
2020
```
2121

22-
## Set environment variables
23-
24-
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:
25-
26-
```bash
27-
NODEMAILER_USER
28-
NODEMAILER_PASSWORD
29-
```
30-
31-
You can do this by:
32-
33-
- Editing the `.env.example` file
34-
- Rename the `.env.example` file to `.env`
35-
3622
## Run the demo app
3723

3824
This compiles and serves the Electron app and starts the backend API server on port 3001.

examples/with-thirdpartypasswordless-electron/src/renderer.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,21 @@ SuperTokens.init({
7777
functions: (oI) => {
7878
return {
7979
...oI,
80-
getAuthorisationURLFromBackend: async (input) => {
80+
getThirdPartyAuthorisationURLWithQueryParamsAndSetState: async (input) => {
81+
/**
82+
*
83+
* We override the frontendRedirectURI here because
84+
* we have a custom API on the backend which will handle the callback
85+
* from the provider and redirect to the electronapp via a deep link.
86+
* So from the point of view of the provider, the frontend that it
87+
* needs to redirect to is that custom API, which is in the API layer.
88+
*
89+
*/
8190
input = {
8291
...input,
83-
redirectURIOnProviderDashboard: getApiDomain() + "/auth/callback/" + input.thirdPartyId,
92+
frontendRedirectURI: getApiDomain() + "/auth/callback/" + input.thirdPartyId,
8493
};
85-
return oI.getAuthorisationURLFromBackend(input);
94+
return oI.getThirdPartyAuthorisationURLWithQueryParamsAndSetState(input);
8695
},
8796
};
8897
},

0 commit comments

Comments
 (0)