• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by Jargon · Sep 23, 2013 at 09:38 AM · assetfacebookintegrationcookie

Facebook SDK for Unity, server-side code and cookies

I posted this on the forum but got no response over the weekend so I thought I'd post it here. Might be a better place for it anyway.

I've been trying to update our current Unity project to use the new Facebook SDK for Unity and all the lovely features that come with. Up until now all we've had is a server-side implementation to request permissions using the PHP SDK. We held off on further implementation as we knew the new SDK was going to be released imminently.

However, now that we're implementing it, we've run into a slight problem getting it to fit with our current process. Now that Facebook Apps can link directly to a deployed .unity3d file, the PHP page that the web player used to sit in no longer gets hit and as a result, none of the PHP code is executed. We used the server-side code and PHP SDK to do the account creation for new users but because this is no longer being hit, new accounts are no longer created.

In the settings for the Facebook SDK for Unity asset, it actually has a tick box for "Cookie" with a description that implies usage in server-side code... but I have no idea how I'm supposed to access this cookie when the web page specified as the Facebook App's (Secure) Canvas URL is never hit... not even once.

alt text

I've searched around and can't find anyone else with a similar problem, so either I'm doing something wrong or it's not been encountered? Hopefully it's something simple and I'm just being daft

Anyone know how to solve this?

Thanks!

fbsdkscreenie.png (25.2 kB)
Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by abrady · Sep 23, 2013 at 10:02 PM

Hi @Jargon, you're correct that the new SDK won't hit your servers explicitly any longer as only the static file is fetched by the canvas page. I can't tell you what the best approach would be, but you have two approaches:

  1. Implementing your account creation flow in C# and using the WWW class to post to your servers (i.e. an RPC flow)

  2. using native calling to pop up an iframe or popup for account creation

  3. redirecting to a webpage that serves your login flow (basically the same as 2, but maybe simpler)

  4. continue to serve your game as you are currently, but use the Unity SDK. You can still compile the your game with the SDK and get the benefits from it, the one thing you miss out on is native in-unity dialogs.

I'd suggest 1 if you want to bring your game to mobile at some point. Or 4.

Thanks for trying out the SDK!

Aaron

Comment

People who like this

0 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jargon · Sep 24, 2013 at 06:53 AM 0
Share

Thanks @abrady, I've already kind of been going down option 1 already, but it's good to know its the right option. Going to attempt to pick up the cookie set by the Unity app and stick it in the header of the request made by the WWW class. This way I can feed it into the PHP SDK server-side and continue as normal :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

16 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to Upload/integrate Unity web player game to facebook app? 1 Answer

FB.Apprequest problem 0 Answers

A node in a childnode? 1 Answer

Facebook Integration for Android Game 1 Answer

Staging Area "is library" error! 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges