Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.27 KB

README.md

File metadata and controls

50 lines (33 loc) · 1.27 KB

flutter_twitch_auth

pub package

This package will provide a modal login with Twitch, you can get the "code" provided by the Twitch API to create your own authentication flow or get a user object once authentication is complete.

Created by Claudio Oliveira (https://twitter.com/cldlvr)

Buy me a coffee ☕

Live Example

Add dependency

dependencies:
  flutter_twitch_auth: ^0.0.1 #latest version

Easy to use

// Initialize authentication with your app on the Twitch API

void main() {

  FlutterTwitchAuth.initialize(
    twitchClientId: "<YOUR_CLIENT_ID>",
    twitchClientSecret: "<YOUR_CLIENT_SECRET>",
    twitchRedirectUri: "<YOUR_REDIRECT_URI>",
  );

  runApp(MyApp());
}

...

//Show modal and get logged user data
void _handleTwitchSignIn() async {
  User? user = await FlutterTwitchAuth.authToUser(context);
}

//Or get the user code and use it with the Twitch API (or Flutter Twitch Package) to create your own login flow.
void _handleTwitchSignIn() async {
  String? code = await FlutterTwitchAuth.authToCode(context);
}
...