flutter_auth0_client 0.0.5 copy "flutter_auth0_client: ^0.0.5" to clipboard
flutter_auth0_client: ^0.0.5 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) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              ElevatedButton(
                  onPressed: () async {
                    final credentials = await FlutterAuth0Client.login(
                        clientId: dotenv.env["AUTH0_CLIENT_ID"],
                        domain: dotenv.env["AUTH0_DOMAIN"],
                        scope: "openid offline_access");
                    setState(() {
                      _credentials = credentials;
                    });
                  },
                  child: const Text("Login")),
              Text(_credentials?.accessToken ?? '')
            ],
          ),
        ),
      ),
    );
  }
}
7
likes
0
pub points
29%
popularity

Publisher

unverified uploader

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