VaREST plugin

Hi guys just wondering if anyone could explain how to setup the blueprint to use vaREST and UMG to create a user login system. Every thread I found pointed me to the plugin but I can’t find any tutorials on how to do it.

I’m hoping someone here can. Thanks

Here I the link to the plugin in case it helps

I too would love to see a tutorial

Yeah I want to see the same thing. I feel like it should be easy to do.

This is just a quick guide, not a proper tutorial – I haven’t seen any, yet.

  1. Setup your REST server that will respond to authentication by replying with either Success or Failure (and session key perhaps?). We did this in node.js with mysql back end, but other solutions are as viable (any web service that will serve request will do, even if it only supports GET and POST). Test it that it works when you use browser or any of the browser extensions to help with this. I use Postman for Chrome.

  2. In UnrealEngine Create Widget with username and password fields and a button. Bind OnClicked action to this button, that creates request, and process response. You may want to disable the button after sending the request, until its processed. If request succeeds, you may want to ‘Remove From Parent’ the widget with login fields, and do whatever you plan to do next.

This post has a clear screenshot on how everything hangs together:

It is a little bit out of date since there were new features since the post, but overall principle is the same. Example doesn’t pass any input parameters, but it shows how to handle response. In your widget, this will be triggered from your OnClicked event.

This post from ufna clearly shows how to construct request parameters:

Once you get your OnComplete called, connect Request to GetResponseObject(), and from Response, GetStringField() – (or other types) that you need. Note that ‘OnRequestFail’ is called when there is 404 or 500 error, or timeout. NOT when user successfully typed wrong password. You’ll get OnRequestComplete, hopefully with message that it ‘failed’ – from step 1.

Something like this:

Forgot to mention:

From architecture point of view, you shouldn’t let client talk to your back end directly. If possible, let client connect to Unreal Dedicated Server, then pass login info via RPC’s, and then get Dedicated Server to talk to your web service. That way you can limit only dedicated server to have access to web service (by IP range, or by a fact that service doesn’t even have public IP address).

Your Dedicated Server can throttle password hack attempts, and prevent people without your game from attempting to login in the first place.

On the other hand, if you build some sort of game launcher, eg with you could do authentication there, and then pass session id to client… Authentication web service that will be exposed to the world should only do that – authenticate and issue session ID’s, and nothing else. (make different service to do all the real work for authenticated users).