Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by stringa · Nov 05, 2010 at 11:05 PM · facebooksecurity

Using WWW / Unity3 and Making Calls to Facebook OpenGraph API

Hello.

I was wondering if it was possibly to make calls to the Facebook OpenGraph API, so my code is what's wrong.

Basically, is this Unities security, or is it my code...

Everything I do, will not return the correct data

IEnumerator Load() { //Security.PrefetchSocketPolicy("www.facebook.com", );

 while (!CookieCutter.IsLoaded())
 {
     yield return StartCoroutine(WebUtils.WaitFor(0.1f));
 }

 string cookieValue = CookieCutter.GetCookie(theLimitCookieName);

 if(string.IsNullOrEmpty(cookieValue))
 {
     cookieValue = CookieCutter.GetCookie(debugCookieName);  
 }

 // --- Hash the cookie values
 if (!string.IsNullOrEmpty(cookieValue))
 {
     cookieValue = cookieValue.Trim('\"');

     string[] nameValues = cookieValue.Split('&');

     Hashtable hashTable = new Hashtable();

     foreach (string element in nameValues)
     {
         string[] splitElement = element.Split('=');

         if(splitElement.Length == 2)
             hashTable[splitElement[0].Trim('"')] = splitElement[1].Trim('"');
     }

     long.TryParse((string)hashTable["uid"], out _uid);

     _accessToken = (string)hashTable["access_token"];

 }

         t = "LoadFriends : " + UID;

 // --- Now lets do a web call
 WWW fbFriendsReq = new WWW("https://graph.facebook.com/me/friends?access_token=" + UID);

 yield return WebUtils.WaitForRequest(fbFriendsReq);

// --- these calls never return the correct data...isDone = false, and error is undefined

t = "Returned from WebUTils : Done : " + fbFriendsReq.isDone + " Error : " + fbFriendsReq.error;

 t = "Recieved Friends : " + fbFriendsReq.text; 

// --- Execution never makes it here

_friends = FacebookFriends.CreateFromJSON(fbFriendsReq.text);

 t = "Friends Created From JSON";

 yield return WebUtils.WaitFor(0.01f);

}

Comment
Add comment · Show 1
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 stringa · Nov 06, 2010 at 12:42 AM 0
Share

adding in Security.PrefetchSocketPolicy("graph.facebook.com", 80); still doesn't seem to solve my problems

4 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by JDonavan 1 · Nov 06, 2010 at 02:16 AM

The server you're connecting to would need to respond with a policy file that gives the Unity Web Player permission. So unless you can convince Facebook to put up a security file for all us Unity folks you're going to have to resort to the standard, call out to the enclosing web page trick.

Comment
Add comment · 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
0

Answer by stringa · Nov 06, 2010 at 01:12 AM

I see that... Security.PrefetchSocketPolicy("graph.facebook.com", 8080) is most likely the call I need to make. but what happens is that PrefetchPolicy returns false... ALWAYS...

This is the graph.facebook.com/crossdomain.xml


Is there something invalid about this domain policy?

Is my code bad above to do a web request?

This code used to work with Unity2.6, and I'm handling all your new security stuff...I just can't get it to work.

There is always the work around of reading it through my ASP page and sending it in through UnityObject.SendMsg...thus I can get around all of unity's "security"....

Also, This cross domain stuff, isn't really that secure....

Say I need to use Texture.SetPixel()... What I can do, is send it to myself, through a web-call, in my own IIS server.

For example : http://mydomain.com?convertImage="http://otherdomain.com/imagetoconvert.jpg"

and this Http request just returns the image...

Walla...now the image is coming from my own domain, and I can modify it with SetPixel.

I just circomvented any security you implemented...I know this works, because I've done it with flash.

Anyways, Why doesn't the WWW call work in the original post? Is there something fundamentally wrong with the WWW code? Can I expect that the line after yield return WWWcall, has a valid Object?

Thanks, stringa

Comment
Add comment · 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
0

Answer by stringa · Nov 06, 2010 at 06:35 AM

Is there something wrong with this crossdomain policy, that isn't supported by Unity?

<?xml version="1.0" ?> 
  <!DOCTYPE cross-domain-policy (View Source for full doctype...)> 
 <cross-domain-policy>
  <allow-access-from domain="*" secure="false" /> 
  <site-control permitted-cross-domain-policies="master-only" /> 
  </cross-domain-policy>
Comment
Add comment · 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
0

Answer by Rageous · Sep 15, 2011 at 09:30 AM

PrefetchSocketPolicy needs an IP address, host name willn't work.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Facebook for Android SSL Problem 0 Answers

How do I enable my Unity weplayer game on facebook to be playable when a facebook user has secure browsing enabled? 1 Answer

unity3d to build a web player to create a game which works with facebook sdk .. Is this possible? 1 Answer

How to parse Json file in android? 3 Answers

Publish to Facebook with a single login? 0 Answers


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