Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 krisventure · Apr 02, 2017 at 07:56 PM · androidvrfacebookloginauthentication

Facebook login dialogue won't appear in VR projects

Dear fellow Gear (or other) VR developers. I'm trying to implement screenshot sharing on Facebook from my game.

The Facebook SDK for Unity works for conventional Android games because opening the browser or a pop up window on top of the app to let the user authenticate, log in or give read / publish permissions is fine. But with the phone inserted into Gear VR, this doesn't work anymore. Only with the Developer mode turned on. The authentication window simply doesn't show up.

Anyone knows of any workaround? Any way to get the pop up window shown in a world space canvas inside VR?

After extensive research I've only found one related thread so far: https://forums.oculus.com/developer/discussion/29507/facebook-authentification-on-samsung-gear-vr Where mdbnet describes something that may help:

Created a web-view plug-in for Android and managed to copy the render buffer to a Unity texture using GetNativeTexturePtr so that it could be displayed in a floating window.

​ But before I'd invest time to start implementing his way without any sample code or confirmation by others, I thought I'd see if anyone already succeeded this way or another way to get Facebook authentication in VR?

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

Answer by krisventure · Apr 05, 2017 at 08:59 PM

The answer is this is not possible as of 2017 April. I understand now why no one ever posted any code to have Facebook login for a VR game. Facebook SDK Unity integration rarely provides any functions that work on VR. Facebook dialogues won't show up.

In case I use the only VR-compatible Webview in asset store as of now, this one has no solution for click detection on Gear VR for the moment (although it does for Cardboard and Daydream, so you may want to give it a try on that platform). OnPointerClick() somehow doesn't fire and it even suppresses OnMouseButtonUp() from firing, the method that would normally detect Gear VR's touchpad clicks. Tried cooperating with the asset's author who was kind enough but has no device at his disposal. The issue was way more complicated that we could solve it within the time I can afford on this question. Even if I had the clicks working, one would still need a Gear VR-compatible virtual keyboard to type in password, because apparently there is no way to avoid asking for password at least for the first time of using the app: Facebook can't detect that user is already logged in on native Facebook app or in the browser, again, probably because apps running in VR are sandboxed in a way that Facebook SDK is not used to. But I guess having a virtual keyboard would solve the issue, unless the security weakness of typing password on such keyboard is a problem.

The only alternative doesn't work either: You can't open Facebook login page in an external browser while running a Gear VR app. I've managed, after showing a message 'Please remove phone from Gear VR to connect to Facebook', to open the login URL in external browser, calling Application.openURL() from OnApplicationQuit(). But then the token will be returned to this token, not to the app. Tried relaunch the app from the redirect URL you can append the facebook login URL with, for this I've tried all possible app URL methods (adding intent filter to manifest with scheme 'http' and host 'myapp.auth', adding http://myapp.auth as Valid Oauth URL in the app's Facebook dev page, but Samsung default browser didn't offer to open the app, automatically handled it as website request. Tried many more ways, no way to get redirected back to the app and pass the token to it directly. So the only way you could get this work using this alternative is to set up a server (which I really don't want to start just for this) and use its address as redirect URL. Then you can create some PHP code on your server and catch the token sent over there, you will need to take care of encrypting it, and storing it as a hash code. Then from your app you could get the token. The amount of security steps to be taken from that point is overwhelming though (you can't store app secret code on client side, etc), I mean all this effort is just not worth it to get your game screenshot shared on Facebook. That's probably why we haven't seen VR game screenshots being shared directly from the game by some share features.

As for the sharing of screenshots on Facebook, that would be already manageable once you'd have a solution for the above issues with authentication and permissions. The best way is to 'silently' upload it to a Facebook an auto-generated album via FB.API("me/photos?no_story=1",Httpmethod.Post, etc). Then get the uploaded photo's URL from the callback and call FB.API("me/feed", etc) with the message and link to the photo URL. Reason: simply posting it to me/photos will result in posting the ever-growing album itself rather than just the last image the player would want to share. But sharing the image's link in feed is fine. Both of these Graph API calls need publish_actions permissions though, so you need to submit your app for review. If you want to avoid that, you need to use FeedShare or ShareLink methods but they can't upload the image so you'd need to upload the image to your own server first, which may end up expensive if you have many shares and not to mention you need to take care of all the server side coding, storing username, encryption etc. So to me it sounds much better if you can get your app reviewed and have the image uploaded to Facebook.

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

83 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 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 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 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 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 avatar image avatar image avatar image

Related Questions

Facebook login crash on Android. FB.Login 2 Answers

Facebook SDK v4.2.4 - Android - Login not working 11 Answers

How can i resize the Unity Facebook Editor Login? 1 Answer

unfortunately, app has stopped when trying to log into Facebook from mobile 1 Answer

Facebook SDK login problem on Android 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