Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Connecting FitBit through Unity using current Plug Ins (WebView)

We have a problem connecting FitBit to Unity through the game.

 

The issue is this, https://dev.fitbit.com/docs/oauth2/.  Specifically, "Android applications may use Chrome Custom Tabs instead of app switching to the default browser. Use of WebView is prohibited."

 

The problem is that there is only one useful plugin to allow webviewing ingame, which using webview.

 

We currently have Apple's Health Aoo connected to the game and not being able to connect the game using currently available plug ind for unity prevents us and other developers from launching on Android based devices, which is a much bigger market.

 

Has anyone created a plug in that allows for use of Chrom Custom Tabs in Unity?  Or what is a way to solve this issue?

Best Answer
0 Votes
6 REPLIES 6

My team and I have been reading up on solutions to this issue.  It seems like every developer uses WebView, even though the documentation says it is prohibited.

 

Is it prohibited or is WebView allowable?  Why is it prohibitied and what does that even mean?

Best Answer
0 Votes

In the same boat. 

Would love to know what us Unity devs are supposed to do.

Best Answer
0 Votes

I'm not familiar with Unity development, but I think you need to call Application.OpenURL.


timlcooley wrote:

Is it prohibited or is WebView allowable?  Why is it prohibitied and what does that even mean?


WebViews are not permitted. Applications should foreground the native browser to display the Fitbit OAuth 2 authorization page. Then, applications should use custom URL handlers as callback URLs so the user is returned to the app after authorizing.

 

WebViews can be used an attack vector. Apps could intercept people's Fitbit password and modify the authorization page's contents. We permit SFSafariViewController and Chrome Custome Tabs, as they provide the necessary security constraints to prevent the type of attacks described earlier.

Best Answer
0 Votes

The problem with that is using Application.OpenURL doesn't allow us to get a callback from it (at least not that I or anyone else I've found has been able to do such.) as that just opens the native browser. 

 

I'd be willing to use the natvie or the SFSafariViewController/Chrome Tabs if I could actually put it in my app without having to go and likely, wrap everything manually just to be able to use it...

Best Answer
0 Votes

@TEvashkevich wrote:

The problem with that is using Application.OpenURL doesn't allow us to get a callback from it (at least not that I or anyone else I've found has been able to do such.) as that just opens the native browser. 


This is what custom URL schemes allow you to do. You need to register your scheme (e.g. myapp://) and decide on a callback path (e.g. myapp://auth/fitbit/callback). Then, Fitbit will redirect the user to your app from the device's browser.

Best Answer
0 Votes

Yes I'm aware that they do that, the problem is that it's a very very big pain to capture the access token when using Unity as you don't have as easy as Native apps (meaning I can't just grab it from Intents etc). 

I've been trying to get it to work with android plugins and such but it's really not working...gonna have to keep smashing my head against this wall instead of doing meaningful development till it's fixed it seems.

Best Answer
0 Votes