flutter_auth0_client 0.1.2 copy "flutter_auth0_client: ^0.1.2" to clipboard
flutter_auth0_client: ^0.1.2 copied to clipboard

outdated

Auth0 Client for iOS, Android, and Web.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_auth0_client/flutter_auth0_client.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

void main() async {
  await dotenv.load();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Auth0Credentials? _credentials;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final client = FlutterAuth0Client(
        clientId: dotenv.env["AUTH0_CLIENT_ID"]!,
        domain: dotenv.env["AUTH0_DOMAIN"]!,
        scope: "openid offline_access");
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              ElevatedButton(
                  onPressed: () async {
                    final credentials = await client.login();
                    setState(() {
                      _credentials = credentials;
                    });
                  },
                  child: const Text("Login")),
              Text(_credentials?.accessToken ?? '')
            ],
          ),
        ),
      ),
    );
  }
}
7
likes
0
points
51
downloads

Publisher

unverified uploader

Weekly Downloads

Auth0 Client for iOS, Android, and Web.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

auth0_spa_dart, flutter, flutter_web_plugins

More

Packages that depend on flutter_auth0_client