# expo-fitbit

> Add fitbit authentication to your expo managed react native apps

Latest version **1.0.0** (published 2023-12-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install expo-fitbit
pnpm add expo-fitbit
yarn add expo-fitbit
bun add expo-fitbit
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-12-18 |
| First published | 2023-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 294.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Turtlepaw |
| Maintainers | turtlepaw |

## Links

- npm: https://www.npmjs.com/package/expo-fitbit
- Repository: https://github.com/beaverfy/expo-fitbit
- npm.io page: https://npm.io/package/expo-fitbit

## Dependencies (4)

- [expo](https://npm.io/package/expo.md) ^49.0.21
- [react](https://npm.io/package/react.md) ^18.2.0
- [react-native](https://npm.io/package/react-native.md) ^0.73.0
- [expo-auth-session](https://npm.io/package/expo-auth-session.md) ^5.2.0

## Recent versions

- 1.0.0 (latest) — 2023-12-18

## README

![@beaverfy/expo-fitbit (image)](./expo-fitbit.png)
# @beaverfy/expo-fitbit
Add fitbit authentication to your expo managed react native apps

## Getting Started
### Installation
#### Using yarn
```shell
yarn add @beaverfy/expo-fitbit
```
#### Using NPM
```shell
npm install @beaverfy/expo-fitbit
```

### Getting Credentials
Register an app on [dev.fitbit.com](https://dev.fitbit.com/apps/new), fill out your app details and select client, since we'll be using the credentials in our app

Once you've created your app, edit your app to have the redirect url: `scheme://fitbit` (replacing scheme with your app's scheme)

### Intergrating into your project
> We're still working on this section

Wrap your app in `FitbitProvider`:
```tsx
import { FitbitProvider } from "@beaverfy/expo-fitbit";
import Constants from "expo-constants";
import { MMKV } from 'react-native-mmkv';
export const storage = new MMKV({
    id: `authentication`,
    encryptionKey: 'random-password'
});

<FitbitProvider configuration={{
    clientId: "CLIENT_ID",
    clientSecret: "CLIENT_SECRET",
    appScheme: Constants.expoConfig.scheme,
    scopes: ["profile"],
    storage: {
        get: (key) => storage.getString(key),
        set: (key, value) => storage.set(key, value)
    },
    onLogin(user) => console.log("User logged in:", user);
}}>
    {/* app code... */}
</FitbitProvider>
```

Get the user's profile data with the `useFitbit` hook:
```tsx
const {
    userData,
    isLoading,
    isLoggedIn
} = useFitbit();

return <Text>Logged in as: {userData?.name}</Text>
```

---
_Source: https://npm.io/package/expo-fitbit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
