unofficial_twitch_auth 0.0.1
unofficial_twitch_auth: ^0.0.1 copied to clipboard
Wrapper of Twitch API for authentication processes
This package allows to validate, revoke or authenticate your client using the newest Twitch API.
Features #
It contains the following methods:
- getLoginLink: used to retrieve the login link
- validate: the endpoint /oauth2/validate allows to validate the token retrieved
- revoke: the endpoint /oauth2/revoke allows to revoke the token
For more information see the class twitch_authentication.dart
Getting started #
- Go to the dev website: https://dev.twitch.tv
- Open "Your Console"
- Register a new application with: name, OAuth redirect and the category
When you finish to set it up, you will redirect to your app. Here you can your Client ID and secret token (don't share to anyone!)
Usage #
You can use with Provider to retrieve the implementation instance:
List<SingleChildWidget> _initProvider() {
return [
...
Provider<TwitchAuthentication>(
create: (ctx) => TwitchAuthenticationImpl(),
),
];
}
Or you can use get_it library to register your instance and its implementation:
GetIt getIt = GetIt.instance;
void setup() {
getIt.registerSingleton<TwitchAuthentication>(
TwitchAuthenticationImpl()
);
}
Additional information #
If you want a real example, see the main app