Support Topics Documentation Slack YouTube Blog

Signup/Signin with Facebook in Unity using Rest API


(Stephan) #1

Hi there,

What is the workflow for a Unity App using Rest API for Social Signup/Signin?
Because there is nothing mentioned about providing a UI, with username password or authenticity token etc
https://backendless.com/documentation/users/rest/users_facebook_login.htm

Regards


(Stephan) #2

Another problem is i dont see where to put O-Auth Redirect.

Looks like following documentation require update
https://backendless.com/documentation/manage/mgmt_social_settings.htm


(Sergey Chupov) #3

Hi ARafay,

The workflow with REST API from Unity App is exactly the same as from any other framework or without it. The UI has nothing to do with the REST API, you should implement it on your own.

If you specify the problem in more details, like what have you already tried and what not worked as expected, I think we’ll be able to help you more.

As to the documentation, the task to update it is already created and is in progress, the task ID is BKNDLSS-13014.


(Stephan) #4

So First Problem is that im unable to put O-Auth Redirect on FB App Security Settings as i dont see them, link + attachment in above comment.


(Sergey Chupov) #5

The new workflow is to click “+ Add Product” on the left menu, select “Get started” near “Facebook login” section and set the Valid OAuth URL there.
http://support.backendless.com/public/attachments/a9fd4cd5a5c5ebb214cbc430e3d0f97d.png</img>http://support.backendless.com/public/attachments/b265c0a7b80380050c30081fb532194e.png</img>


(Stephan) #6

Thanks for your prompt reply,
After updating ReDirect URI. Now when i make a Rest Call from Unity3D i get following error.






&lt;!DOCTYPE html&gt;
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Action not found&lt;/title&gt;
		&lt;link rel=&quot;shortcut icon&quot; href=&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAlFJREFUeNqUU8tOFEEUPVVdNV3dPe8xYRBnjGhmBgKjKzCIiQvBoIaNbly5Z+PSv3Aj7DSiP2B0rwkLGVdGgxITSCRIJGSMEQWZR3eVt5sEFBgTb/dN1yvnnHtPNTPG4PqdHgCMXnPRSZrpSuH8vUJu4DE4rYHDGAZDX62BZttHqTiIayM3gGiXQsgYLEvATaqxU+dy1U13YXapXptpNHY8iwn8KyIAzm1KBdtRZWErpI5lEWTXp5Z/vHpZ3/wyKKwYGGOdAYwR0EZwoezTYApBEIObyELl/aE1/83cp40Pt5mxqCKrE4Ck+mVWKKcI5tA8BLEhRBKJLjez6a7MLq7XZtp+yyOawwCBtkiBVZDKzRk4NN7NQBMYPHiZDFhXY+p9ff7F961vVcnl4R5I2ykJ5XFN7Ab7Gc61VoipNBKF+PDyztu5lfrSLT/wIwCxq0CAGtXHZTzqR2jtwQiXONma6hHpj9sLT7YaPxfTXuZdBGA02Wi7FS48YiTfj+i2NhqtdhP5RC8mh2/Op7y0v6eAcWVLFT8D7kWX5S9mepp+C450MV6aWL1cGnvkxbwHtLW2B9AOkLeUd9KEDuh9fl/7CEj7YH5g+3r/lWfF9In7tPz6T4IIwBJOr1SJyIGQMZQbsh5P9uBq5VJtqHh2mo49pdw5WFoEwKWqWHacaWOjQXWGcifKo6vj5RGS6zykI587XeUIQDqJSmAp+lE4qt19W5P9o8+Lma5DcjsC8JiT607lMVkdqQ0Vyh3lHhmh52tfNy78ajXv0rgYzv8nfwswANuk+7sD/Q0aAAAAAElFTkSuQmCC&quot;&gt;
	    &lt;style&gt;
		    html, body, pre {
		        margin: 0;
		        padding: 0;
		        font-family: Monaco, 'Lucida Console', monospace;
		        background: #ECECEC;
		    }
		    h1 {
		        margin: 0;
		        background: #AD632A;
		        padding: 20px 45px;
		        color: #fff;
		        text-shadow: 1px 1px 1px rgba(0,0,0,.3);
		        border-bottom: 1px solid #9F5805;
		        font-size: 28px;
		    }
		    p#detail {
		        margin: 0;
		        padding: 15px 45px;
		        background: #F6A960;
		        border-top: 4px solid #D29052;
		        color: #733512;
		        text-shadow: 1px 1px 1px rgba(255,255,255,.3);
		        font-size: 14px;
		        border-bottom: 1px solid #BA7F5B;
		    }
		&lt;/style&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;h1&gt;Action not found&lt;/h1&gt;


		&lt;p id=&quot;detail&quot;&gt;
			For request 'POST /v1//users/social/oauth/facebook/request_url'
		&lt;/p&gt;


	&lt;/body&gt;
&lt;/html&gt;

(Sergey Chupov) #7

Look at the URL you’re trying to access, it’s invalid since it cannot contain two slashes in a row:

For request 'POST /v1//users/social/oauth/facebook/request_url'

(Stephan) #8

Sorry for my stupidity, i fixed it and now im getting response as

“‘303 See other’”

which is good as it means im on right track.

Now what’d be next step? What do i do after it?


(Sergey Chupov) #9

This means that the request is redirected - and this is expected. Along with this code you receive a header named ‘Location’, which contains the URL to which you should be redirected. In your case this is the URL to Facebook authentication service, if follow it you’ll see a login page where you should enter your Facebook login and password. In response you’ll receive a BackendlessUser.


(Stephan) #10

Now the problem comes

Unity3D doesnt have a WebView, so what we can do is open url on user browser where user can get authenticated, however then there is no way to get information back from browser instance.

So what do you suggest here?


(Sergey Chupov) #11

Unfortunately, we can’t help you further since we don’t officially support Unity yet and thus don’t know what it can suggest in order to take advantage of our REST API.


(Stephan) #12

Looks like ill have to use a 3rd party web view for this purpose.
Thanks for your help, i was able to do both FB and Twitter, and will post a seperate thread for Google+ :slight_smile: