Skip to content

Commit

Permalink
fixes electron app code (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhpoddar authored Apr 19, 2024
1 parent 4cfb00d commit 7f017c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
2 changes: 0 additions & 2 deletions examples/with-thirdpartypasswordless-electron/.env.example

This file was deleted.

14 changes: 0 additions & 14 deletions examples/with-thirdpartypasswordless-electron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
15 changes: 12 additions & 3 deletions examples/with-thirdpartypasswordless-electron/src/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
};
},
Expand Down

0 comments on commit 7f017c4

Please sign in to comment.