callback of a server

0

Galera, I am involved in a project that requires the use of the Fitbit API. In my code, I redirect the user to the FITBIT website to authorize the use of the data. After authorizing, I need to get the URL to get the Oauth code. How do I make a callback function of this redirect? It is not really an ajax request because I do not use neither get nor post nor put, I just redirect the user.

    
asked by anonymous 06.03.2017 / 22:22

1 answer

0

I do not know if Fitbit uses Oauth2, but if so it works as follows:

Step 1: You redirect the user to the authentication page by passing the id and callback URL via GET method

Step 2: Fitbit invokes the URL you passed by passing a code via GET method

Step 3: You get the code you received and api secret and resubmit to Fitbit via the POST method.

At this point, Fitbit will return you a JSON with access_token, which is what you will use for each API call.

IMPORTANT Your server should be accessible on the internet, if you are using the server. Your private network or a virtual machine, you must configure the router / firewall to release external access to port 80 and 443.

Good luck

    
06.03.2017 / 23:30