
Authentication System
This showcase will show that UE4 can use HTTP requests to perform request from unreal, and reciving respond from PHP scripts in json format
So first of all, we have to create some form of widget that will ask user for data(username, password, etc) the class could look like this:
LoginMenu.h

In LoginMenu.cpp let's explain functions and what's inside
NativeConstruct function simply binding functions that will reacting on login button and register button

OnLoginButtonClick function is kinda bigger, let's tear it apart into two pieces, one for validation of information second part for performing HTTP request
This part of function taking data from our UEditableTextBox's and checking in first place that they aren't empty, next step is checking if given data is is valid under lenght of data in our fields, 3rd part checking if password has length enough and last part by using C++ standard regex is checking under special characters and no spaces.
Second part of our function will create and send HTTP request to PHP scripts
FAuthData is structure of data that hold temporary informations about user(email, password, isLoggedIn...)
Request is performed to "localhost" on xampp server aplication, headers I chose to accepts json and strings as respond(which we can popup errors from server side eventualy)
Either we have to convert our struct of data into Json format and send it to PHP script.


Let's investigate PHP script the we called in our request:

How respond function looks like?
Well it's pretty simple, like this:
Firstly we checking if bConnectedSuccessfully is false
if it is we have to send information "Server is not responding" and return from function.
If our bConnectedSuccessfully is true
then we are able to retrive informations from respond, checking which type of response we got
If it's Json then we reconstruct our Json code and fill up our FAuthData struct.
It is string? well in this step we know loggin script didn't success so we can popup a information from server.

How registration process could looks like? Very simillar to login process, creating widget that will retrive information from user, send request to PHP, PHP will ask database by using SQL(depends how registration process was planned) then we can send back result/information from PHP script, where on app side(client) we can process depends on respond.