I have both an electron app and a web app that do ...
# support-questions-legacy
b
I have both an electron app and a web app that do different things. When I sign in through the Electron app, the Electron app starts showing the webapp. Where can I change this? So that Electron just goes to its own main renderer.tsx file. I found this: https://supertokens.com/docs/thirdpartypasswordless/pre-built-ui/auth-redirection But not sure how I can differentiate web/Electron.
r
hey @big_bongster does the electron app have its own native login U?
b
No, the electron app uses React so I am also just using the provided React components
r
right. So what exactly happens after login?
b
It loads the web page into Electron, instead of returning to the "/" route of Electron
It's going to the "/" route of the WebApp.
r
as in it's opening the browser?
b
yes
r
whats the configured websiteDomain?
b
appInfo: { appName: 'app', apiDomain: GetConfig().apiUrl, websiteDomain: 'http://localhost:3000', apiBasePath:
${GetConfig().apiUrl}/auth
, // websiteBasePath: '/auth', },
r
on the frontend
b
on the frontend it's the url of the website
r
right. I think cause you have set it to localhost, it opens the browser.
b
That was for electron
Why does the websiteDomain for the frontend matter?
Using localhost:3000 works until I point apiDomain and apiBasePath to a non-localhost domain
r
hmm.
the apiDomain should not affect how the frontend redirection works
b
Yes I copied that and it works great when everything is on localhost. But now I'm trying to deploy and I'm having the redirect issue. I'm fixing something else right now, so after that, I'll try to tinker with this some more. Thanks for your help.
r
sounds good. Im not quite familiar with electron, so hard to help without having a demo app that can reproduce the issue.
b
Ok the issue is the callback redirect if I use a social provider. It is redirecting me (I think) to
websiteDomain: 'http://localhost:3000',
. I just copied that from the example here: https://github.com/supertokens/supertokens-auth-react/blob/4b2a650f8ac520a769829c42b8e1d2284cc66025/examples/with-thirdpartypasswordless-electron/src/renderer.tsx#L52 When I use email + OTP sign in, it works fine.
Not sure what the comment means about not supporting file protocol
r
right. I thikn you need to make the social provider redirect to your backend layer, which calls asn API which redirects to your electron app. Not sure, but it be in our demo app.
b
Ah I see. There's some deeplink protocol and redirect handlers. Complex. I'll try to see if I can get it working. Thanks
r
yeaaa.. unfortunately providers can't deep link to your app. So this is sort of a workaround. It's there in the example app though.
b
Hmm, I tried running the Electron example, and I think it might be out of date. If I try to log in using Google, I just see "Cannot GET /auth/callback/google" as the only HTML in the Electron app. I think it is suffering from the same issue where it is getting redirected to localhost:3000. In this case, the server has a handler on "/auth/callback/google" that redirects to the deeplink.
Not sure what the solution is. Can I somehow just manually set the redirect uri ?
r
hmm. Can you open an issue about this? We will fix the demo app sometime this / next week.
> Can I somehow just manually set the redirect uri ? Where? From google back to your app?
@Darko , here
r
thanks
b
Yes, in the issue, I wrote down what my understanding of the desired redirects is
r
right. So google then needs to redirect you to your api layer, and a route on your api layer which you create (a GET API). Have you done that?
b
Yeah, I've just copied the example app
But it didn't work, so then I tried the example app and it didn't work either
d
gonna take a look soon, will keep you posted @big_bongster
b
Thank you darko
Were you able to repro?
d
haven't gotten around to it, but on my agenda today
@big_bongster got an error from the demo; not exactly the same, but it obviously doesn't work. I'll take a look.
replied on GH too
b
Cool, thanks!
ay update on this?
d
Not really, but I'm working intermittently on this 🙂
haven't forgotten about it, no worries 😄
oh and btw, @big_bongster, do you mind opening a thread with this on #1224328457589227540 ?
we're moving our support over there, so that it's searchable and everyone has a better overall exeperience
b
ok sure
15 Views