0

I want to create an OAuth registration/login process for my non-web application written in golang. For that, when my application is opened, I open the browser with an OAuth URL and after the successful authenitcation, the redirect_uri is set to my own url scheme myapp:// to reopen my application and pass the authentication token to it.

I managed to let my golang application register it's url scheme itself with Handling url schemes with golang? and wenn I type in my scheme like myapp:// the browser prompts me as expected if I want to open my application.

But when I click "yes open it" it just opens a cmd very shortly (or nothing when I compile it with go build -ldflags -Hwindowsgui) and nothing else happens and I also don't get any logfiles written by my application, so I am pretty sure that nothing is executed.

If I change the executeable path in the registry of the scheme to open something like C:\Windows\System32\notepad.exe it opens the Windows editor as expected.

I also tried to put my application in a Windows-folder but still nothing is executed.

I can't find any ressource on the internet regarding this problem.

Do I need to do something security wise so my application is executed, because it seems that Windows blocks the execution of my application?

One guess would be that my freshly compiled golang executable is not digital signed and therefor not executed because of security risks? Or is there something else I'm missing? Or is there another way to create url schemes for applications in local development?

Thanks for any help!

Soma
  • 123
  • 2
  • 5
  • What if you add `time.Sleep(time.Hour)` at the very beginning of your program's `main` function? Does it start and _sit there?_ Be sure to compile it _without_ `-Hwindowsgui` because otherwise you won't get any visual hint about the app actually running. Better yet—add `fmt.Println("something")` before going to sleep. – kostix Sep 05 '22 at 10:21
  • no that didn't help, nothing pops up and there is nothing in the task manager. everything works when I directly execute the compiled .exe, so it has nothing to do with runtime errors or something that would stop the execution of the program. – Soma Sep 05 '22 at 10:33
  • Do you have any antivirus software installed? If yes, does it have logs/ability to turn them on temporarily? – kostix Sep 05 '22 at 10:56
  • I don't have any antivirus software installed, just the windows defaults are running – Soma Sep 05 '22 at 11:05
  • The answer to [this question](https://stackoverflow.com/questions/80650/) appear to use different registry root for registration than the answer you've referred to. Is this because of Windows 11 peculiarities (the answer I've found is old); if not, what if you'll try to follow the advice given there? – kostix Sep 05 '22 at 12:13

0 Answers0