0.1.4 • Published 2 years ago

useitch v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

useItch

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

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

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

PropsValue
itchIoClientIdThe clientId for your Itch.io oAuth Application.
scopeThe only available value to date is profile:me
redirect_uriThe redirect URI of your Itch.io oAuth Application

useItch

All the current paramenters are contained in the user object.

ParametersTypeNotes
isLoggedBooleanThe state of login.
isLoadingBooleanIt's true while the user data are being fetched.
logInfunctionLogIn function, redirects to Itch.io oAuth page.
logOutfunctionClears all the relevant state.
dataString(s)user data. Please refer to the Itch.io /me API call

Troubleshooting

You can track issues on the GitHub issue tracker. I'll try to address them the best I can.

Roadmap

  • first implementation: oAuth and user info
  • implementing the games purchased scope 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.