magic_ext_oidc 0.0.4 copy "magic_ext_oidc: ^0.0.4" to clipboard
magic_ext_oidc: ^0.0.4 copied to clipboard

A Magic oidc extension to support Magic login authentication

example/example.dart

import 'package:flutter/material.dart';

import 'package:magic_sdk/magic_sdk.dart';
import 'package:magic_ext_oidc/magic_ext_oidc.dart';
import 'package:magic_ext_oidc/types/open_id_configuration.dart';

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

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  Magic magic = Magic.instance;

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Magic OIDC Demo Login'),
          automaticallyImplyLeading: false,
        ),
        body: Center(
            child:
                Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          TextButton(
            style: ButtonStyle(
              foregroundColor: MaterialStateProperty.all<Color>(Colors.blue),
            ),
            onPressed: () async {
              var configuration = OpenIdConfiguration(
                jwt: 'JWT_FROM_YOUR_OPEN_ID PROVIDER',
                providerId:'YOUR_MAGIC_PROVIDER_ID');

              var did = await magic.openid.loginWithOIDC(configuration);

              debugPrint('Your DID is: $did');
            },
            child: const Text('OIDC Login'),
          ),
        ])));
  }
}
1
likes
130
points
78
downloads

Publisher

verified publishermagic.link

Weekly Downloads

A Magic oidc extension to support Magic login authentication

Homepage

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, magic_sdk, webview_flutter

More

Packages that depend on magic_ext_oidc