# useitch

> An unofficial and bare minimal implementation of Itch.io oAuth and APIs

Latest version **0.1.4** (published 2022-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install useitch
pnpm add useitch
yarn add useitch
bun add useitch
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.4 |
| Published | 2022-02-10 |
| First published | 2022-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Edoardo Cremaschi |
| Maintainers | nuclearmanatee |
| Keywords | itch.io, react, oAuth |

## Links

- npm: https://www.npmjs.com/package/useitch
- Repository: https://github.com/NuclearManatee/useItch
- Homepage: https://github.com/NuclearManatee/useItch#readme
- Issues: https://github.com/NuclearManatee/useItch/issues
- npm.io page: https://npm.io/package/useitch

## Dependencies (5)

- [react](https://npm.io/package/react.md) 17.0.2
- [core-js](https://npm.io/package/core-js.md) ^3.21.0
- [react-dom](https://npm.io/package/react-dom.md) 17.0.2
- [react-scripts](https://npm.io/package/react-scripts.md) 4.0.0
- [@babel/polyfill](https://npm.io/package/@babel/polyfill.md) ^7.12.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.4 (latest) — 2022-02-10
- 0.1.3 — 2022-02-09
- 0.1.2 — 2022-02-09
- 0.1.1 — 2022-02-09
- 0.1.0 — 2022-02-09

## README

# useItch

An unofficial and bare minimal implementation of [Itch.io APIs](https://itch.io/docs/api/overview).

**Fair Warning**, this is a very first implementation and it might break quite spectacularly.
**DO NOT CONSIDER THIS PRODUCTION READY**

The main Use Case for this library is to build Companion Apps that can enforce your desired type of paywall trough the Itch.io storefront.

## Installation

Using [npm](https://www.npmjs.com/)

```
npm install useitch
```

## Getting Started

Wrap you application with `ItchProvider`.

Use the `useItch` hook in your components to access auth state (`isLogged`, `isLoading` and `user`) and auth method (`logIn` and `logOut`).


### ItchProvider

Props | Value
--- | --- 
**itchIoClientId** | The clientId for your [Itch.io oAuth Application](https://itch.io/user/settings/oauth-apps).
**scope** | The only available value to date is `profile:me`
**redirect_uri** | The redirect URI of your Itch.io oAuth Application

### useItch

All the current paramenters are contained in the `user` object.

Parameters | Type | Notes
--- | --- | ---
**isLogged** | Boolean | The state of login.
**isLoading** | Boolean | It's `true` while the user data are being fetched.
**logIn** | function | LogIn function, redirects to Itch.io oAuth page.
**logOut** | function | Clears all the relevant state.
**data** | String(s) | user data. Please refer to the [Itch.io /me API call](https://itch.io/docs/api/serverside#reference/profilegames-httpsitchioapi1keymy-games)

## Troubleshooting

You can track issues on the [GitHub issue tracker](https://github.com/NuclearManatee/useItch/issues). I'll try to address them the best I can.

## Roadmap

- [x] first implementation: oAuth and user info
- [ ] implementing the [games purchased scope](https://itch.io/docs/api/serverside#reference/profilegames-httpsitchioapi1keymy-games) for check games ownership
- [ ] session persistance
- [ ] automation testing
- [ ] Expo compatible
- [ ] React Navigator compatible
- [ ] Nextjs compatible

## Contribution

Contributions are **absolutely open**. Just submit a pull request or drop me an email if you want a more steady collaboration.

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