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 TEvashkevich · May 26, 2015 at 12:39 PM · mobilecallback

Fitbit CallbackURL

Hey everyone,

I'm trying to get a mobile(droid and hopefully iOS if all goes well) game started that centres around getting data from a user's fitbit and then uses it for in game stats.

I'm running into a pretty big problem where I can get Unity to open a browser window to prompt the user for confirmation. When you hit Allow it correctly produces the OAuth authorization token I would need to grab to be able to get the users data.

Problem is that I have no idea how to get that url from the browser so I can strip the token and authorization token from it. No matter what I try, no matter what library I have tried I can't get it to work.

So I'm trying to find someone that has successfully done OAuth or might be able to give me help figuring out how to get it working with FitBit (since maybe it' just not working correctly with Unity?)

The URL I've got that works for the launching via Application.OpenURL is https://www.fitbit.com/oauth2/authorize?response_type=code&client_id=229PH8&redirect_uri=http%3A%2F%2FfitRPGcallback≻ope=activity%20profile%20sleep%20social

I'm not sure if it's just the callback url that isn't right (it's set as the same in the API) or if it is in fact just missing a way to capture it from Unity itself...

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by TEvashkevich · Jan 03, 2016 at 08:59 AM

I forgot to come back and answer this as I was able to get it working eventually.

http://technicalartistry.blogspot.ca/2015/07/oauth2-unity-and-month-of-cursing.html

There is a write up here about the basics of getting it to work and some of the specifics.

EDIT: Did another blogpost about Fitbit, OAuth2 and Unity for Android. This came because Fitbit no longer allows the use of Webviews to do Authentication for security reasons (which is what I was using in the above blogpost) http://technicalartistry.blogspot.ca/2016/01/fitbit-unity-oauth-2-and-native.html This explains how to do it with the use of an Android plugin which is quite easy to make AND free (because you do it yourself :) )

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 HabitMonster · Jul 09, 2015 at 04:17 PM

I was able to get FitBit to work with OAuth 1.0, though I'm sure the 2.0 implementation is easier. There were two main tricks: one is to use a more robust HTTP library, as I found the WWW implementation shipped with Unity does not allow for the required POST payload. The second is to use an in-app Web library such as UniWebView, which allows you to pick off the callback URL with the auth token. Good luck. Feel free to message me privately and I'll be happy to share code with you.

Comment
Add comment · Show 2 · 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 AshishGaur · Dec 31, 2015 at 03:09 PM 0
Share

Can u please share the code ...?

avatar image TEvashkevich AshishGaur · Jan 14, 2016 at 09:17 AM 0
Share

Check my answer if you want to know how to do it (code is included :) )

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

State machine callbacks not being called on mobile iOS? 1 Answer

Does OnApplicationPause actually work? 3 Answers

Which is better? Switching out Textures or Instantiating Different prefabs? 1 Answer

How do I config NGUI screen to fit Mobile device? 2 Answers

Some texuters looks darker on some mobiles 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