0 purchases
djangoflow auth discord
🌟 DjangoFlow Auth Discord Flutter Package 🌟
djangoflow_auth_discord brings the power of Discord authentication to your Flutter app! Seamlessly integrate Discord login functionalities into the DjangoFlow framework. Enjoy custom OAuth2 configuration, web and mobile support, and a consistent API through the DiscordSocialLoginProvider class. It's time to level up your app with Discord login! 🔒🎮
Empower your users with the convenience of Discord login using djangoflow_auth_discord, and provide a seamless authentication experience in your app.
🚀 Features 🚀
Effortless integration with the DjangoFlow framework.
Discord login using the OAuth2 protocol using Implicit Grant Flow.
Customizable OAuth2 configuration for advanced scenarios.
Full support for both web and mobile(Android & iOS) platforms.
Consistent and easy-to-use API through the DiscordSocialLoginProvider class.
📦 Installation 📦
Add the djangoflow_auth_discord package to your pubspec.yaml file:
dependencies:
djangoflow_auth: <latest_version>
djangoflow_auth_discord: <latest_version>
oauth2_client: <latest_version> # Check for the latest version
copied to clipboard
Run flutter pub get to fetch the package.
Note: Follow oauth2_client package for platform related configuration.
For Web Only: For web configuration, to receive callback your redirectUri should point to an html file from your web application. The html file should contain this html code. For example you can put/create this html file in your flutter_project/web/auth.html
<!DOCTYPE html>
<title>Authentication complete</title>
<p>
Authentication is complete. If this does not happen automatically, please
close the window.
<script>
window.opener.postMessage(
{
type: "callback",
url: window.location.href,
},
"*"
);
</script>
</p>
copied to clipboard
🔧 Usage 🔧
To use the DiscordSocialLoginProvider for Discord authentication, follow these steps:
Import the necessary packages:
import 'package:djangoflow_auth/djangoflow_auth.dart';
import 'package:djangoflow_auth_discord/djangoflow_auth_discord.dart';
import 'package:flutter/foundation.dart';
copied to clipboard
Initialize DiscordSocialLoginProvider with your OAuth2 configuration:
final discordLogin = DiscordSocialLoginProvider(
oAuth2Configuration: OAuth2Configuration(
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'YOUR_REDIRECT_URI',
customUriScheme: 'YOUR_CUSTOM_SCHEME',
state: 'OPTIONAL_STATE',
scope: 'SCOPE_STRING',
),
type: SocialLoginType.fromProvider(ProviderEnum.discord),
);
copied to clipboard
Perform the Discord login:
final token = await discordLogin.login();
// Handle the login result, e.g., extract the access token
if (token != null) {
// Proceed with authentication or user data retrieval
} else {
// Handle login failure
}
copied to clipboard
Read more here for a detailed example on how to use it with djangoflow_auth: https://pub.dev/packages/djangoflow_auth#setting-up-authcubit
🌟 Example 🌟
Example
👏 Contributions and Issues 👏
Contributions, bug reports, and feature requests are welcome! Feel free to submit a pull request or open an issue on the GitHub repository.
🛠 Troubleshooting 🛠
Due to oauth2_client does not support http: ^1.0.0, you may need to override dependency of http to ^1.0.0 version.
Can be removed one https://github.com/teranetsrl/oauth2_client/pull/168 merged.
Custom Uri Scheme: For non-web platforms, ensure that you've provided a valid customUriScheme in the OAuth2 configuration. This is required for handling the OAuth2 flow on mobile platforms. Best to use with http/https host and valid scheme that have verification of your ownership. Look here for more details:
https://docs.flutter.dev/cookbook/navigation/set-up-app-links#3-hosting-assetlinksjson-file
https://docs.flutter.dev/cookbook/navigation/set-up-universal-links#apple-app-site-association
📄 License 📄
This package is distributed under the MIT License.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.