Login using google

Hello, I have a question regarding the application and would like to know if you could help.
As it currently works, when a client tries to log in to our application via Google, our application will close, and only reopen once the client is redirected back through a clickable link (the redirect link won’t work if the application is running).
Is there a way for the redirect link to work if the application is already running? (Ideally, the application does not close and open every time just for the link to work).



If I understood it correctly, you’re using the app’s url scheme to pass the token from the log-in back to the app. As such, since the app is already opened, it isn’t launching it again with the token?

If that is the case, it CAN actually be fixed, using overwolf.extensions.onAppLaunchTriggered

Let me know if that helped!

This is the redirect URL that I use on my API. It works if the app is closed before I call it, but if the app is running, the login page does not reload.
Thank you for your help.

In that case, it seems like the issue is exactly that.
If you listen to this event, then once the link is clicked, it will simply launch this event with the data from the link, which will let you handle it.

If you need help with the specific implementation, feel free to send here the code that you use to handle the redirect when the app is closed, and I’ll be able to help with converting it to also support the link when the app was already running.

[ var url = decodeURIComponent(location.href);
var code_splited = url.split(‘?code=’)[1];
if (typeof (code_splited) !== ‘undefined’) {

This is the code.

And just making sure, have you tried to specifically, before running the redirect, run:
And if so, did it run/print anything?

I tried it now, sorry I don’t understand first.
console.log return void I want a callback function to get the result in a variable not just to print it.

Ah, that’s the easier part
You can switch out the console.log part for anything else, for example:

overwolf.extensions.onAppLaunchTriggered.addListener((launched) => yourProcessingMethodHere(launched));

As long as it printed it, that means it ran successfully, so now you can just switch the print out for logic

Okay, my problem has been solved, thank you very much for helping me out.

1 Like