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

Authenticating users using my Nodejs Web API

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

Best Answer
0 Votes
3 REPLIES 3

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.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

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.

Best Answer
0 Votes

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. 

Best Answer
0 Votes