Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

126
Views
How to access localhost access token after redirect using react-native?

I am trying to access the fitbit API through oAuth on react-native. User login via fitbit works and after this, localhost is redirected and the access token is shown within the endpoint on the browser.

The issue i am facing currently is how can i get this access token from the browser in order to start fetching data from the fitbit api using the users access token within an android react-native application?

I am currently generating the oauth url and allowing the user to login. The issue is that after login is successful, there is no way i can retrieve the access token.

function OAuth(client_id, cb) {
    const oauthurl = `https://www.fitbit.com/oauth2/authorize?${qs.stringify({
        client_id,
        response_type: "token",
        scope: "heartrate activity activity profile sleep",
        redirect_uri: "http://localhost",
        expires_in: "31536000",
    })}`;
    console.log(oauthurl);
    // Linking.openURL(oauthurl).catch((err) =>
    //  console.error("Error processing linking", err)
    // );
}

After login is successful, this is the url i get back in the browser which contains the access token:

http://localhost/#access_token=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIyM0JCSzUiLCJzdWIiOiI5TEJSUEMiLCJpc3MiOiJGaXRiaXQiLCJ0eXAiOiJhY2Nlc3NfdG9rZW4i2IK2F0fX1UuuIwZDbc4&user_id=9LBRPC&scope=sleep+heartrate+profile+activity&token_type=Bearer&expires_in=31534747

As mentioned previously, how can i get this access token back into my application to be used?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!