Skip to content

Commit

Permalink
Add support for custom OAuth providers, bump version 0.7.1 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
shilgapira authored Sep 19, 2023
1 parent 2efc93d commit 75d6b0a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.7.1

- Add support for custom OAuth providers

# 0.7.0

- Added Magic Link support to Flows
Expand Down
6 changes: 6 additions & 0 deletions lib/src/sdk/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ abstract class DescopeEnchantedLink {
abstract class DescopeOAuth {
/// Starts an OAuth redirect chain to authenticate a user.
///
/// // use one of the built in constants for the OAuth provider
/// final authUrl = await Descope.oauth.start(provider: OAuthProvider.google);
///
/// // or pass a string with the name of a custom provider
/// final authUrl = await Descope.oauth.start(provider: OAuthProvider.named("myprovider"));
///
/// This function returns a URL to redirect to in order to
/// authenticate the user against the chosen [provider].
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sdk/sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DescopeSdk {
static const name = 'DescopeFlutter';

/// The Descope SDK version
static const version = '0.7.0';
static const version = '0.7.1';

/// The configuration of the [DescopeSdk] instance.
final DescopeConfig config;
Expand Down
20 changes: 13 additions & 7 deletions lib/src/types/others.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ enum DeliveryMethod {
}

/// The provider to use in an OAuth flow.
enum OAuthProvider {
facebook,
github,
google,
microsoft,
gitlab,
apple,
class OAuthProvider {
static final OAuthProvider facebook = OAuthProvider.named("facebook");
static final OAuthProvider github = OAuthProvider.named("github");
static final OAuthProvider google = OAuthProvider.named("google");
static final OAuthProvider microsoft = OAuthProvider.named("microsoft");
static final OAuthProvider gitlab = OAuthProvider.named("gitlab");
static final OAuthProvider apple = OAuthProvider.named("apple");
static final OAuthProvider slack = OAuthProvider.named("slack");
static final OAuthProvider discord = OAuthProvider.named("discord");

final String name;

OAuthProvider.named(this.name);
}

/// Used to provide additional details about a user in sign up calls.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: descope
description: A Flutter package for working with the Descope API.
version: 0.7.0
version: 0.7.1
homepage: https://www.descope.com
repository: https://github.com/descope/descope-flutter
issue_tracker: https://github.com/descope/descope-flutter/issues
Expand Down

0 comments on commit 75d6b0a

Please sign in to comment.