Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
33cd75f
enhances v 0.2.0
devdennysegura Jan 31, 2019
8265c8c
fixed expiration token time
devdennysegura Jan 31, 2019
7c5d53c
Merge pull request #1 from devdennysegura/master
gregertw Feb 14, 2019
7e6a9f4
Fix for migration to AndroidX (using API 28)
Feb 14, 2019
fcd3650
Merge pull request #8 from gregertw/master
devdennysegura Feb 15, 2019
9a88ab4
changes
devdennysegura Aug 9, 2019
079df06
fixes blank login page
devdennysegura Aug 9, 2019
17a874e
change changelog version error
devdennysegura Aug 9, 2019
771a484
fixes pub.dev
devdennysegura Aug 9, 2019
aeed335
fixes pub.dev
devdennysegura Aug 9, 2019
eabf8cb
Issue #18 : Fix SIGABRT (NULLPOINTER) on iOS Web Login Flow
Aug 13, 2019
978f89a
Merge pull request #19 from cschwalm/bug/issue_18_bad_url
devdennysegura Aug 20, 2019
8512406
update homepage
devdennysegura Aug 23, 2019
41c6351
Merge branch 'master' of https://github.com/devdennysegura/flutter-auth0
devdennysegura Aug 23, 2019
0061362
changes on handler, fixes blank screen and change code stack
devdennysegura Aug 26, 2019
903c8f9
changes
devdennysegura Aug 26, 2019
6dd0e8f
change import dart suggestions
devdennysegura Aug 26, 2019
0107c77
update images on readme
devdennysegura Aug 26, 2019
5650464
flutter publish suggestions
devdennysegura Aug 26, 2019
ea876d1
update pubspec description
devdennysegura Aug 26, 2019
3165326
Fixed HashMap<String, String>' has no instance getter 'token'
sawankumarbundelkhandi Sep 12, 2019
33b9758
Json key should be same.
sawankumarbundelkhandi Sep 12, 2019
eda629e
Merge pull request #20 from sawankumarbundelkhandi/master
devdennysegura Sep 18, 2019
574e8e1
handling 401 status code in index file
sawankumarbundelkhandi Sep 27, 2019
a009b16
Handling statusCode 401 in management api calls
sawankumarbundelkhandi Sep 27, 2019
e9194b1
Merge pull request #1 from devdennysegura/master
sawankumarbundelkhandi Sep 27, 2019
9d2e4f1
Update index.dart
sawankumarbundelkhandi Sep 27, 2019
2fd71fd
Merge pull request #24 from sawankumarbundelkhandi/Unauthorized-patch
devdennysegura Oct 2, 2019
00c8e64
Regardless of the federated flag, it is always attempted. This fix re…
cschwalm Oct 14, 2019
940c403
Merge pull request #26 from cschwalm/master
devdennysegura Oct 17, 2019
3c05523
Upgrate to Flutter 1.12.
Dec 17, 2019
2e8cf54
Revert unexpected changes
Dec 26, 2019
571ec4c
Remove .flutter-plugins file
Dec 26, 2019
33d30b0
PR review
Jan 7, 2020
e97c9cf
PR review
Jan 7, 2020
cf94206
Merge pull request #31 from carlosesquivel-katoo/master
devdennysegura Jan 31, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
397 changes: 388 additions & 9 deletions .gitignore

Large diffs are not rendered by default.

91 changes: 67 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,63 @@
## v0.0.1 (2018-10-31)
## v0.5.0 (2019-08-09)

A Flutter plugin to use the [Auth0 API](https://auth0.com/docs/api/authentication).
breaking changes:

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!
- parameter to use auth0 authentication

## Usage
To use this plugin, add `flutter_auth0` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
features:

## SignIn with email and password
- users handler
- get user info
- update user info

To signin instance auth0 using `auth0-client-id` and `auth0-domain` and call signInWithEmailAndPassword function with email and password as params
## v0.3.1 (2019-08-09)

```dart
fixes:

final auth = new Auth0(clientId: 'your-client-id', domain: 'your-domain');
- pub.dev fixes

Auth0User user = await auth.passwordRealm(
username: 'username/email',
password: 'password',
realm: 'Username-Password-Authentication');
```
## v0.3.0 (2019-08-09)

fixes:

- blank login page

## Example
## v0.2.2 (2019-08-08)

See the [example application](https://github.com/devdennysegura/flutter-auth0/tree/master/example) source
for a complete sample app using the auth0 authentication.
fixes:

- minor fixes

## v0.2.1 (2019-01-31)

fixes:

- Expiration token in seconds.

## v0.2.0 (2019-01-30)

enhances:

- Error handler when sign-in/sign-up.

## v0.1.0 (2019-01-10)

features:

- Refresh token integrated.

enhances:

- directory layout was change.

## v0.0.2 (2018-12-03)

### Using Authorization Code flow with PKCE

![alt](screenshots/web-login.png)

### Callback URL(s)

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add this URL to your Application's Allowed Callback URLs for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

Go to the [Auth0 Dashboard](https://manage.auth0.com/#/applications), select your application and make sure that **Allowed Callback URLs** contains the following:
Expand All @@ -49,11 +75,12 @@ Go to the [Auth0 Dashboard](https://manage.auth0.com/#/applications), select you
```

### To use

#### Android

In the file `android/app/src/main/AndroidManifest.xml` you must make sure the **MainActivity** of the app has a **launchMode** value of `singleTask` and add the following activity:

So if you have `samples.auth0.com` as your Auth0 domain you would have the following **MainActivity** configuration:
So if you have `samples.auth0.com` as your Auth0 domain you would have the following **MainActivity** configuration:

![manifes-activity](screenshots/new-activity.png)

Expand All @@ -62,11 +89,11 @@ Create the file **RedirectUriReceiver.java**
![RedirectUriReceiver.java](screenshots/receiver.png)

#### iOS

Inside the ios folder find the file AppDelegate.[swift|m] add the following to it

![RedirectUriReceiver.java](screenshots/AppDelegate.png)


Inside the `ios` folder open the `Info.plist` and locate the value for `CFBundleIdentifier`, e.g.

```xml
Expand All @@ -92,10 +119,26 @@ and then register a URL type entry using the value of `CFBundleIdentifier` as th
</array>
```

## v0.1.0 (2019-01-10)
## v0.0.1 (2018-10-31)

features:
- Refresh token integrated.
A Flutter plugin to use the [Auth0 API](https://auth0.com/docs/api/authentication).

enhances:
- directory layout was change.
Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

## Usage

To use this plugin, add `flutter_auth0` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

## SignIn with email and password

To signin instance auth0 using `auth0-client-id` and `auth0-domain` and call signInWithEmailAndPassword function with email and password as params

```dart

final auth = new Auth0(clientId: 'your-client-id', domain: 'your-domain');

Auth0User user = await auth.passwordRealm(
username: 'username/email',
password: 'password',
realm: 'Username-Password-Authentication');
```
96 changes: 12 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,13 @@ A Flutter plugin to use the [Auth0 API & Auth0 PKCE flow](https://auth0.com/docs
Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

<div style="display:flex;flex-direction:row;">
<img src="screenshots/flutter_01.png" alt="screen_01" height="300" />
<img src="screenshots/flutter_02.png" alt="screen_02" height="300" />
<img src="screenshots/flutter_03.png" alt="screen_02" height="300" />
<a href="https://imgur.com/8FXqlC6"><img src="https://i.imgur.com/8FXqlC6.png" title="demo" height="300"/></a>
<a href="https://imgur.com/4cf1lji"><img src="https://i.imgur.com/4cf1lji.png" title="pkce success" height="300"/></a>
<a href="https://imgur.com/gQBDeWX"><img src="https://i.imgur.com/gQBDeWX.png" title="api login demo" height="300"/></a>
<a href="https://imgur.com/hyKGgBX"><img src="https://i.imgur.com/hyKGgBX.png" title="api login demo filled fields" height="300"/></a>
<a href="https://imgur.com/u4o6Qar"><img src="https://i.imgur.com/u4o6Qar.png" title="api login sucess" height="300"/></a>
</div>

## Authentication API
### Usage
To use this plugin, add `flutter_auth0` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

## SignIn with email and password

To signin instance auth0 using `auth0-client-id` and `auth0-domain` and call signInWithEmailAndPassword function with email and password as params

![normal-login](screenshots/normal-login.png)

### Using Authorization Code flow with PKCE
![alt](screenshots/web-login.png)

### Callback URL(s)
Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 routes your application back to this URL and appends additional parameters to it, including a token. Since callback URLs can be manipulated, you will need to add this URL to your Application's Allowed Callback URLs for security. This will enable Auth0 to recognize these URLs as valid. If omitted, authentication will not be successful.

Go to the [Auth0 Dashboard](https://manage.auth0.com/#/applications), select your application and make sure that **Allowed Callback URLs** contains the following:

#### iOS

```text
{YOUR_BUNDLE_IDENTIFIER}://${YOUR_AUTH0_DOMAIN}/ios/{YOUR_BUNDLE_IDENTIFIER}/callback
```

#### Android

```text
{YOUR_APP_PACKAGE_NAME}://{YOUR_AUTH0_DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback
```

### To use
#### Android

In the file `android/app/src/main/AndroidManifest.xml` you must make sure the **MainActivity** of the app has a **launchMode** value of `singleTask` and add the following activity:

So if you have `samples.auth0.com` as your Auth0 domain you would have the following **MainActivity** configuration:

![manifes-activity](screenshots/new-activity.png)

Create the file **RedirectUriReceiver.java**

![RedirectUriReceiver.java](screenshots/receiver.png)

#### iOS
Inside the ios folder find the file AppDelegate.[swift|m] add the following to it

![RedirectUriReceiver.java](screenshots/AppDelegate.png)


Inside the `ios` folder open the `Info.plist` and locate the value for `CFBundleIdentifier`, e.g.

```xml
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
```

and then register a URL type entry using the value of `CFBundleIdentifier` as the value of `CFBundleURLSchemes`

```xml
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>auth0</string>
<key>CFBundleURLSchemes</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</array>
```

## Example

See the [example application](https://github.com/devdennysegura/flutter-auth0/tree/master/example) source
Expand All @@ -93,12 +21,12 @@ for a complete sample app using the auth0 authentication.

Auth0 helps you to:

* Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.
* Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**.
* Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user.
* Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely.
* Analytics of how, when and where users are logging in.
* Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules).
- Add authentication with [multiple authentication sources](https://docs.auth0.com/identityproviders), either social like **Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others**, or enterprise identity systems like **Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider**.
- Add authentication through more traditional **[username/password databases](https://docs.auth0.com/mysql-connection-tutorial)**.
- Add support for **[linking different user accounts](https://docs.auth0.com/link-accounts)** with the same user.
- Support for generating signed [Json Web Tokens](https://docs.auth0.com/jwt) to call your APIs and **flow the user identity** securely.
- Analytics of how, when and where users are logging in.
- Pull data from other sources and add it to the user profile, through [JavaScript rules](https://docs.auth0.com/rules).

## Create a free Auth0 Account

Expand All @@ -113,4 +41,4 @@ This readme based on [react-native-auth0](https://github.com/auth0/react-native-

## License

This project is licensed under the MIT license. See the [LICENSE](LICENSE.txt) file for more info.
This project is licensed under the MIT license. See the [LICENSE](LICENSE.txt) file for more info.
2 changes: 1 addition & 1 deletion android/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
Binary file removed android/.gradle/4.10.2/fileChanges/last-build.bin
Binary file not shown.
Binary file removed android/.gradle/4.10.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file removed android/.gradle/4.10.2/fileHashes/fileHashes.lock
Binary file not shown.
Empty file.
13 changes: 12 additions & 1 deletion android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
connection.project.dir=
arguments=
auto.sync=false
build.scans.enabled=false
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(5.4))
connection.project.dir=../example/android
eclipse.preferences.version=1
gradle.user.home=
java.home=
jvm.arguments=
offline.mode=false
override.workspace.settings=true
show.console.view=true
show.executions.view=true
4 changes: 4 additions & 0 deletions android/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=12
org.eclipse.jdt.core.compiler.compliance=12
org.eclipse.jdt.core.compiler.source=12
11 changes: 5 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.4.1'
}
}

Expand All @@ -22,17 +22,16 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
compileSdkVersion 27
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
dependencies{
implementation "com.android.support:support-core-utils:27.1.1"
implementation 'com.android.support:customtabs:26.1.0'
}
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.browser:browser:1.0.0' }
}
3 changes: 2 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
3 changes: 0 additions & 3 deletions android/local.properties

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.flutter.plugins.flutterauth0;

import android.app.Activity;
import android.content.Intent;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import io.flutter.plugins.flutterauth0.FlutterAuth0Plugin;

public class AuthenticationReceiver extends Activity {
private static final String TAG = AuthenticationReceiver.class.getName();

public static final String EXTRA_CODE = "Auth0Code";
public static final String EXTRA_ERROR = "Auth0Error";

public void onCreate(Bundle savedInstanceBundle) {
super.onCreate(savedInstanceBundle);
Intent intent = this.getIntent();
Uri uri = intent.getData();
String access_token = uri.getQueryParameter("code");
String error = uri.getQueryParameter("error");
closeView(access_token, error);
}

private void closeView(String token, String errorMessage) {
Intent intent = new Intent(AuthenticationReceiver.this, FlutterAuth0Plugin.getActivity().getClass());
intent.putExtra(EXTRA_CODE, token);
intent.putExtra(EXTRA_ERROR, errorMessage);
if (errorMessage != null)
setResult(Activity.RESULT_CANCELED, intent);
else
setResult(Activity.RESULT_OK, intent);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
FlutterAuth0Plugin.resolve(token, errorMessage);
startActivityIfNeeded(intent, 0);
finish();
}

}
Loading