03-18-2018 19:11
03-18-2018 19:11
Hello there,
I am trying to create a watchface that would have data coming from my custom API built on nodejs
In order to do that, I need to authenticate the user. So I have written a companion app that has a button in the settings page that can redirect the user to a web page that user can login page. Now, I am able to authenticate the user. But, I would like to know how to redirect back to companion app and retrieve the access token for future API requests. Pls advice. Thanks
03-18-2018 19:27
03-18-2018 19:27
I'm working on something vaguely similar. AFAIK, the companion/settings app(s) can't respond to external requests. Consider using fetch() in the companion to ask the web site for the token, possibly in response to a button press on the settings page. The problem then becomes one of identifying which account to send the token for. The least cumbersome way I can think of is to require the user to type/paste their web site username (or, better, a unique key) into a settings textInput. This is quite messy (and my first attempt was rejected by Fitbit for this reason) and I'm not altogether happy with the security of it either.
03-18-2018 20:33
03-18-2018 20:33
Thanks, Catplace for quick turnaround
I have some limitations on storing/getting user/pass on my website and would need to go through a whole lot of QA if I need to do that.
The ideal solution in my case if to authenticate the user at the third party website level and get access token that I can use in requests from companion app to external web API.
03-21-2018 20:03
03-21-2018 20:03
Folks,
I am able to call external website, able to login and generate a token. Now, how to get this token and redirect back to companion app page (settings or any other page)
Pls advice. Thank you.