asticode / astilectron

Electron app that provides an API over a TCP socket that allows executing Electron's method as well as capturing Electron's events
MIT License
285 stars 67 forks source link

add automatic registration of app:// scheme #19

Open charlieblevins opened 5 years ago

charlieblevins commented 5 years ago

Thanks for astilectron!

I needed this change in order to support the AWS Cognito callback url scheme requirement (https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-idp-settings.html) to allow users to login to my app. Please let me know if you think it would be worth merging in.

asticode commented 5 years ago

Can you walk me through why you need this and what it's actually doing ?

charlieblevins commented 5 years ago

Apologies for the long delay.

One way to use the app:// scheme is to allow deep linking from a website on the internet to the electron application. For example, a website on the internet can execute the following javascript to send a user into the electron application:

// some code in a public web page on the internet
window.location.href = 'app:///home.html';

You could do the above with a file url, but there would be no way to make that path work for every user, as the full path to the electron application will be different for everyone.

My particular need is to send a user using my application to an external web page on the wide-area internet inside electron. When they complete a process (authentication) on that external web page, the web page navigates the user back into my application. This helps me by allowing me to delegate authentication to a third party, which saves me from having to build a completely custom authentication mechanism.

adambrakhane commented 4 years ago

Seems like a really nice feature to me, if you can make it work well. OAuth callbacks are one reason, but any astielectron app that also has a web page could benefit.