To be able to place orders locally using a payment app it needs to be able to communicate with the outside world. Lets have a look how to get that working with ngrok.
1. Download and register ngrok
Download ngrok and sign up free account. We will need that to use https. After you have signed up you will get an authtoken. Fire up you ngrok-terminal and type:
use ngrok.exe if you are using windows.
2. Exposing a server
Open up your docker-compose.yaml-file and scroll down to the ports section of the desired app. Shown below is the direct-payment example, in which we are interested in knowing that it uses port 10011.
The direct-payment app doesn’t need ngrok to work. But since it is present in the default installation of Litium we will use it as an example. You are probably doing this for a payment app such as Svea or Klarna.
Now go back to your terminal and run:
Or this in Windows:
You will now see something looking like this:
Copy the ngrok-url using https and lets continue.
3. Using the ngrok url
Go back to your docker-compose.yaml-file and set the AppMetadata__AppUrl to your ngrok url.
4. Docker time
Now stop your applications in docker and then run:
I got the error Client secret validation failed for client when using a Litium app one day. The reason was that Litium apps are not built to be used in a multiple development environment scenario and another developer has reinstalled an app on his machine. That way the app got new service account-credentials, that my environment did not know about.
One way to access the shared files folder that is used in some projects is to let the IIS application pool use the identity of the user that has access to that shared folder. That won’t work now when we are using the Kestrel web server.
Instead you can map that shared folder as a Network drive and reference that in appsettings.json. In Windows you right click in the explorer and select Add network location, on the mac you open Finder, select Go in the menu and click on Connect to server.