├── .gitattributes ├── src ├── platforms │ ├── ios │ │ ├── Podfile │ │ ├── build.xcconfig │ │ ├── src │ │ │ ├── module.modulemap │ │ │ └── A0ChallengeGenerator.h │ │ ├── Info.plist │ │ └── README.md │ └── android │ │ ├── nativescript_auth0.aar │ │ ├── include.gradle │ │ ├── README.md │ │ └── AndroidManifest.xml ├── common │ ├── jsonObjectPayload.ts │ ├── jsonObjectPayload.d.ts │ ├── databaseUser.d.ts │ ├── credentials.d.ts │ └── databaseUser.ts ├── android │ ├── provider │ │ ├── responseType.d.ts │ │ ├── responseType.ts │ │ ├── redirectActivity.d.ts │ │ ├── flagChecker.d.ts │ │ ├── algorithmHelper.d.ts │ │ ├── callbackHelper.d.ts │ │ ├── flagChecker.ts │ │ ├── customTabsOptions.d.ts │ │ ├── redirectActivity.ts │ │ ├── authCallback.d.ts │ │ ├── authCallback.ts │ │ ├── authorizeResult.d.ts │ │ ├── authenticationActivity.d.ts │ │ └── callbackHelper.ts │ ├── callback │ │ ├── callback.d.ts │ │ ├── callback.ts │ │ ├── baseCallback.d.ts │ │ └── baseCallback.ts │ ├── auth0Exception.d.ts │ ├── util │ │ ├── telemetry.d.ts │ │ └── telemetry.ts │ ├── request │ │ ├── internal │ │ │ ├── voidRequest.d.ts │ │ │ ├── authenticationErrorBuilder.d.ts │ │ │ ├── simpleRequest.d.ts │ │ │ ├── voidRequest.ts │ │ │ ├── authenticationErrorBuilder.ts │ │ │ └── baseAuthenticationRequest.d.ts │ │ ├── request.d.ts │ │ ├── request.ts │ │ ├── authorizableRequest.d.ts │ │ ├── authorizableRequest.ts │ │ ├── errorBuilder.d.ts │ │ ├── errorBuilder.ts │ │ ├── parameterizableRequest.d.ts │ │ ├── parameterizableRequest.ts │ │ ├── authenticationRequest.d.ts │ │ └── authenticationRequest.ts │ ├── result │ │ ├── authentication.d.ts │ │ └── authentication.ts │ ├── auth0Exception.ts │ └── authentication │ │ ├── passwordStrengthErrorParser.d.ts │ │ └── request │ │ ├── tokenRequest.d.ts │ │ ├── tokenRequest.ts │ │ ├── profileRequest.d.ts │ │ └── databaseConnectionRequest.d.ts ├── ios │ ├── requestable.d.ts │ ├── requestable.ts │ ├── result.d.ts │ ├── result.ts │ ├── controllerModalPresenter.d.ts │ ├── responseType.d.ts │ ├── transactionStore.d.ts │ ├── safariAuthenticationSessionCallback.d.ts │ ├── silentSafariViewController.d.ts │ ├── utils.d.ts │ ├── safariAuthenticationSession.d.ts │ ├── handlers.d.ts │ ├── auth0Error.d.ts │ ├── logger.d.ts │ ├── response.d.ts │ ├── responseType.ts │ ├── safariSession.d.ts │ ├── loggable.d.ts │ ├── safariAuthenticationSessionCallback.ts │ ├── transactionStore.ts │ ├── authSession.d.ts │ ├── loggable.ts │ ├── silentSafariViewController.ts │ ├── auth0Error.ts │ ├── safariSession.ts │ ├── webAuthError.d.ts │ ├── telemetry.d.ts │ ├── authenticationError.d.ts │ ├── safariAuthenticationSession.ts │ ├── auth0Authentication.d.ts │ ├── oauth2Grant.d.ts │ ├── authTransaction.d.ts │ └── controllerModalPresenter.ts ├── .npmignore ├── references.d.ts ├── typings │ ├── a0ChallengeGenerator.ios.d.ts │ └── auth0jwt.android.d.ts ├── tsconfig.json ├── scripts │ └── build-native.js ├── auth0-common.ts └── index.d.ts ├── demo-vue ├── types │ ├── env.d.ts │ ├── references.d.ts │ └── shims.vue.d.ts ├── app │ ├── app.scss │ ├── assets │ │ ├── auth0-logo.png │ │ └── nativescript-vue-logo.png │ ├── App_Resources │ │ ├── iOS │ │ │ ├── Assets.xcassets │ │ │ │ ├── Contents.json │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── icon-1024.png │ │ │ │ │ ├── icon-29.png │ │ │ │ │ ├── icon-40.png │ │ │ │ │ ├── icon-76.png │ │ │ │ │ ├── icon-29@2x.png │ │ │ │ │ ├── icon-29@3x.png │ │ │ │ │ ├── icon-40@2x.png │ │ │ │ │ ├── icon-40@3x.png │ │ │ │ │ ├── icon-60@2x.png │ │ │ │ │ ├── icon-60@3x.png │ │ │ │ │ ├── icon-76@2x.png │ │ │ │ │ └── icon-83.5@2x.png │ │ │ │ ├── LaunchImage.launchimage │ │ │ │ │ ├── Default.png │ │ │ │ │ ├── Default@2x.png │ │ │ │ │ ├── Default-1125h.png │ │ │ │ │ ├── Default-568h@2x.png │ │ │ │ │ ├── Default-667h@2x.png │ │ │ │ │ ├── Default-736h@3x.png │ │ │ │ │ ├── Default-Portrait.png │ │ │ │ │ ├── Default-Landscape-X.png │ │ │ │ │ ├── Default-Landscape.png │ │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ │ └── Default-Landscape@3x.png │ │ │ │ ├── LaunchScreen.Center.imageset │ │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ │ └── Contents.json │ │ │ │ └── LaunchScreen.AspectFill.imageset │ │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ │ └── Contents.json │ │ │ └── build.xcconfig │ │ └── Android │ │ │ ├── src │ │ │ └── main │ │ │ │ └── res │ │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── drawable-ldpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── drawable-mdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── icon.png │ │ │ │ ├── logo.png │ │ │ │ └── background.png │ │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ │ └── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ └── app.gradle │ ├── main.ts │ ├── components │ │ └── App.vue │ └── auth0-setup.ts ├── .gitignore ├── babel.config.js ├── nativescript.config.ts ├── webpack.custom.config.js ├── README.md ├── package.json └── tsconfig.json ├── demo ├── references.d.ts ├── app │ ├── assets │ │ ├── auth0-logo.png │ │ └── nativescript-logo.png │ ├── app.css │ ├── app.ts │ ├── main-page.ts │ ├── main-page.xml │ ├── main-view-model.ts │ └── auth0-setup.ts ├── App_Resources │ ├── iOS │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-57.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-57@2x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Default.png │ │ │ │ ├── Default@2x.png │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ └── Default-Landscape@3x.png │ │ │ ├── LaunchScreen.Center.imageset │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ └── Contents.json │ │ │ └── LaunchScreen.AspectFill.imageset │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ └── Contents.json │ │ ├── build.xcconfig │ │ └── Info.plist │ └── Android │ │ ├── src │ │ └── main │ │ │ └── res │ │ │ ├── values-v21 │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ ├── drawable-hdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-ldpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-mdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ └── drawable-nodpi │ │ │ └── splash_screen.xml │ │ └── app.gradle ├── nativescript.config.ts ├── package.json ├── webpack.config.js └── tsconfig.json ├── demo-angular ├── references.d.ts ├── tsfmt.json ├── App_Resources │ ├── iOS │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-20.png │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-20@2x.png │ │ │ │ ├── icon-20@3x.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── LaunchImage.launchimage │ │ │ │ ├── Default.png │ │ │ │ ├── Default@2x.png │ │ │ │ ├── Default-1125h.png │ │ │ │ ├── Default-568h@2x.png │ │ │ │ ├── Default-667h@2x.png │ │ │ │ ├── Default-736h@3x.png │ │ │ │ ├── Default-Portrait.png │ │ │ │ ├── Default-Landscape-X.png │ │ │ │ ├── Default-Landscape.png │ │ │ │ ├── Default-Portrait-XR.png │ │ │ │ ├── Default-Portrait@2x.png │ │ │ │ ├── Default-Landscape-XR.png │ │ │ │ ├── Default-Landscape@2x.png │ │ │ │ ├── Default-Landscape@3x.png │ │ │ │ ├── Default-Landscape-XS-Max.png │ │ │ │ └── Default-Portrait-XS-Max.png │ │ │ ├── LaunchScreen.Center.imageset │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ ├── LaunchScreen-Center@3x.png │ │ │ │ └── Contents.json │ │ │ └── LaunchScreen.AspectFill.imageset │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ ├── LaunchScreen-AspectFill@3x.png │ │ │ │ └── Contents.json │ │ └── build.xcconfig │ └── Android │ │ ├── src │ │ └── main │ │ │ └── res │ │ │ ├── values-v21 │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ ├── drawable-hdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-ldpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-mdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xxhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── drawable-xxxhdpi │ │ │ ├── icon.png │ │ │ ├── logo.png │ │ │ └── background.png │ │ │ ├── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ │ │ └── drawable-nodpi │ │ │ └── splash_screen.xml │ │ └── app.gradle ├── src │ ├── app │ │ ├── app.component.html │ │ ├── app.component.ts │ │ ├── home │ │ │ ├── home-routing.module.ts │ │ │ ├── home.module.ts │ │ │ ├── home.component.html │ │ │ └── home.component.ts │ │ ├── app-routing.module.ts │ │ ├── app.module.ts │ │ └── auth0 │ │ │ └── auth0-setup.ts │ ├── assets │ │ ├── auth0-logo.png │ │ └── nativescript-angular-logo.png │ ├── app.css │ ├── main.ts │ └── polyfills.ts ├── .editorconfig ├── nativescript.config.ts ├── angular.json ├── webpack.config.js ├── .gitignore ├── tsconfig.json └── package.json ├── publish ├── publish.sh ├── package.json └── pack.sh ├── .gitignore ├── LICENSE ├── .github ├── pull_request_template.md └── issue_template.md ├── tslint.json └── CHANGELOG.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text=lf -------------------------------------------------------------------------------- /src/platforms/ios/Podfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/platforms/ios/build.xcconfig: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo-vue/types/env.d.ts: -------------------------------------------------------------------------------- 1 | declare var TNS_ENV: string; -------------------------------------------------------------------------------- /demo/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /demo-angular/references.d.ts: -------------------------------------------------------------------------------- 1 | /// -------------------------------------------------------------------------------- /demo-angular/tsfmt.json: -------------------------------------------------------------------------------- 1 | { 2 | "indentSize": 4, 3 | "tabSize": 4 4 | } 5 | -------------------------------------------------------------------------------- /demo-vue/types/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /demo-vue/types/shims.vue.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.vue' { 2 | import Vue from 'vue'; 3 | export default Vue; 4 | } -------------------------------------------------------------------------------- /demo-vue/app/app.scss: -------------------------------------------------------------------------------- 1 | @import "@nativescript/theme/css/core.css"; 2 | @import "@nativescript/theme/css/default.css"; 3 | -------------------------------------------------------------------------------- /demo/app/assets/auth0-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/app/assets/auth0-logo.png -------------------------------------------------------------------------------- /src/common/jsonObjectPayload.ts: -------------------------------------------------------------------------------- 1 | export interface JSONObjectPayload { 2 | initWithJson(json: { [key: string]: any }): T; 3 | } -------------------------------------------------------------------------------- /src/platforms/ios/src/module.modulemap: -------------------------------------------------------------------------------- 1 | module A0ChallengeGenerator { 2 | header "A0ChallengeGenerator.h" 3 | export * 4 | } -------------------------------------------------------------------------------- /demo-vue/app/assets/auth0-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/assets/auth0-logo.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /demo-angular/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /src/android/provider/responseType.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum ResponseType { 2 | CODE = 1, 3 | TOKEN = 2, 4 | ID_TOKEN = 4 5 | } 6 | -------------------------------------------------------------------------------- /demo-angular/src/assets/auth0-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/src/assets/auth0-logo.png -------------------------------------------------------------------------------- /demo/app/assets/nativescript-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/app/assets/nativescript-logo.png -------------------------------------------------------------------------------- /src/android/provider/responseType.ts: -------------------------------------------------------------------------------- 1 | export enum ResponseType { 2 | CODE = 1 << 0, 3 | TOKEN = 1 << 1, 4 | ID_TOKEN = 1 << 2 5 | } 6 | -------------------------------------------------------------------------------- /src/platforms/android/nativescript_auth0.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/src/platforms/android/nativescript_auth0.aar -------------------------------------------------------------------------------- /demo-vue/.gitignore: -------------------------------------------------------------------------------- 1 | # JetBrains project files 2 | .idea 3 | 4 | # NPM 5 | node_modules 6 | 7 | # NativeScript application 8 | hooks 9 | platforms 10 | -------------------------------------------------------------------------------- /demo-vue/app/assets/nativescript-vue-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/assets/nativescript-vue-logo.png -------------------------------------------------------------------------------- /src/common/jsonObjectPayload.d.ts: -------------------------------------------------------------------------------- 1 | export interface JSONObjectPayload { 2 | initWithJson(json: { 3 | [key: string]: any; 4 | }): T; 5 | } 6 | -------------------------------------------------------------------------------- /demo/app/app.css: -------------------------------------------------------------------------------- 1 | @import "@nativescript/theme/css/core.css"; 2 | @import "@nativescript/theme/css/default.css"; 3 | 4 | .mono { 5 | font-family: monospace; 6 | } 7 | -------------------------------------------------------------------------------- /src/ios/requestable.d.ts: -------------------------------------------------------------------------------- 1 | import { Result } from './result'; 2 | export interface Requestable { 3 | start(callback: (result: Result) => void): any; 4 | } 5 | -------------------------------------------------------------------------------- /src/ios/requestable.ts: -------------------------------------------------------------------------------- 1 | import { Result } from './result'; 2 | 3 | export interface Requestable { 4 | start(callback: (result: Result) => void); 5 | } 6 | -------------------------------------------------------------------------------- /demo-angular/src/app.css: -------------------------------------------------------------------------------- 1 | @import "@nativescript/theme/css/core.css"; 2 | @import "@nativescript/theme/css/default.css"; 3 | 4 | .mono { 5 | font-family: monospace; 6 | } 7 | -------------------------------------------------------------------------------- /demo-angular/src/assets/nativescript-angular-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/src/assets/nativescript-angular-logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values-v21/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3d5afe 4 | -------------------------------------------------------------------------------- /demo-vue/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true) 3 | 4 | return { 5 | presets: [['@babel/env', { targets: { esmodules: true } }]], 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/.npmignore: -------------------------------------------------------------------------------- 1 | *.map 2 | *.ts 3 | !*.d.ts 4 | tsconfig.json 5 | scripts/* 6 | platforms/android/* 7 | !platforms/android/include.gradle 8 | !platforms/android/*.aar 9 | !platforms/android/*.jar -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo/app/app.ts: -------------------------------------------------------------------------------- 1 | import { Application } from '@nativescript/core'; 2 | import { setupAuth0 } from './auth0-setup'; 3 | 4 | setupAuth0(); 5 | 6 | Application.run({ moduleName: 'main-page' }); 7 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /publish/publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PACK_DIR=package; 4 | 5 | publish() { 6 | cd $PACK_DIR 7 | echo 'Publishing to npm...' 8 | npm publish *.tgz 9 | } 10 | 11 | ./pack.sh && publish -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png -------------------------------------------------------------------------------- /publish/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativescript-publish", 3 | "version": "1.0.0", 4 | "description": "Publish helper", 5 | "devDependencies": { 6 | "ncp": "^2.0.0", 7 | "rimraf": "^2.5.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /src/android/provider/redirectActivity.d.ts: -------------------------------------------------------------------------------- 1 | import Bundle = android.os.Bundle; 2 | export declare class RedirectActivity extends android.app.Activity { 3 | constructor(); 4 | onCreate(savedInstanceBundle: Bundle): void; 5 | } 6 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png -------------------------------------------------------------------------------- /demo-angular/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | 3 | @Component({ 4 | moduleId: module.id, 5 | selector: "ns-app", 6 | templateUrl: "app.component.html" 7 | }) 8 | export class AppComponent { } 9 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png -------------------------------------------------------------------------------- /demo-vue/app/main.ts: -------------------------------------------------------------------------------- 1 | import Vue from 'nativescript-vue'; 2 | import App from './components/App.vue'; 3 | import { setupAuth0 } from './auth0-setup'; 4 | 5 | setupAuth0(); 6 | 7 | new Vue({ 8 | render: h => h('frame', [h(App)]) 9 | }).$start(); 10 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sitefinitysteve/nativescript-auth0/HEAD/demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NativeScript-Vue Application 4 | NativeScript-Vue Application 5 | 6 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values-v21/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | NativeScript-Vue Application 4 | NativeScript-Vue Application 5 | 6 | -------------------------------------------------------------------------------- /src/ios/result.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Result object for Auth0 APIs requests 3 | 4 | - Success: request completed successfuly with it's response body 5 | - Failure: request failed with a specific error 6 | */ 7 | export interface Result { 8 | success?: T; 9 | failure?: Error; 10 | } 11 | -------------------------------------------------------------------------------- /src/ios/result.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | Result object for Auth0 APIs requests 4 | 5 | - Success: request completed successfuly with it's response body 6 | - Failure: request failed with a specific error 7 | */ 8 | export interface Result { 9 | success?: T; 10 | failure?: Error; 11 | } -------------------------------------------------------------------------------- /demo-angular/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | charset = utf-8 8 | 9 | [*.json] 10 | indent_style = space 11 | indent_size = 2 12 | 13 | [*.ts] 14 | indent_style = space 15 | indent_size = 4 16 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /src/ios/controllerModalPresenter.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ControllerModalPresenter { 2 | get rootViewController(): UIViewController | undefined; 3 | present(controller: UIViewController): void; 4 | get topViewController(): UIViewController | undefined; 5 | private findTopViewController; 6 | } 7 | -------------------------------------------------------------------------------- /src/ios/responseType.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ResponseType { 2 | readonly rawValue: number; 3 | constructor(rawValue: number); 4 | static readonly token: ResponseType; 5 | static readonly idToken: ResponseType; 6 | static readonly code: ResponseType; 7 | get label(): string | null; 8 | } 9 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #757575 5 | #33B5E5 6 | #272734 7 | -------------------------------------------------------------------------------- /demo/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 5 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 6 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | android { 4 | defaultConfig { 5 | generatedDensities = [] 6 | applicationId = "org.nativescript.auth0demo" 7 | } 8 | aaptOptions { 9 | additionalParameters "--no-version-vectors" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #F5F5F5 4 | #53ba82 5 | #33B5E5 6 | #272734 7 | 8 | -------------------------------------------------------------------------------- /demo/nativescript.config.ts: -------------------------------------------------------------------------------- 1 | import { NativeScriptConfig } from '@nativescript/core' 2 | 3 | export default { 4 | id: 'org.nativescript.auth0demo', 5 | appResourcesPath: 'App_Resources', 6 | android: { 7 | v8Flags: '--expose_gc', 8 | markingMode: 'none' 9 | }, 10 | appPath: 'app', 11 | } as NativeScriptConfig 12 | -------------------------------------------------------------------------------- /src/platforms/ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo-angular/nativescript.config.ts: -------------------------------------------------------------------------------- 1 | import { NativeScriptConfig } from '@nativescript/core' 2 | 3 | export default { 4 | id: 'org.nativescript.auth0demo', 5 | appResourcesPath: 'App_Resources', 6 | android: { 7 | v8Flags: '--expose_gc', 8 | markingMode: 'none', 9 | }, 10 | appPath: 'src', 11 | } as NativeScriptConfig 12 | -------------------------------------------------------------------------------- /demo-vue/nativescript.config.ts: -------------------------------------------------------------------------------- 1 | import { NativeScriptConfig } from '@nativescript/core' 2 | 3 | export default { 4 | id: 'org.nativescript.auth0demo', 5 | appResourcesPath: 'app/App_Resources', 6 | android: { 7 | v8Flags: '--expose_gc', 8 | markingMode: 'none', 9 | }, 10 | appPath: 'app', 11 | webpackConfigPath: './webpack.custom.config.js', 12 | } as NativeScriptConfig 13 | -------------------------------------------------------------------------------- /demo-vue/webpack.custom.config.js: -------------------------------------------------------------------------------- 1 | const webpackConfig = require("./webpack.config"); 2 | 3 | module.exports = env => { 4 | env = env || {}; 5 | if (env.android) { 6 | env.appComponents = env.appComponents || []; 7 | env.appComponents.push("nativescript-auth0/android/provider/redirectActivity"); 8 | } 9 | 10 | const config = webpackConfig(env); 11 | return config; 12 | }; 13 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /demo-angular/src/main.ts: -------------------------------------------------------------------------------- 1 | // this import should be first in order to load some required settings (like globals and reflect-metadata) 2 | import { platformNativeScriptDynamic } from "@nativescript/angular"; 3 | 4 | import { AppModule } from "./app/app.module"; 5 | import { setupAuth0 } from './app/auth0/auth0-setup'; 6 | 7 | setupAuth0(); 8 | 9 | platformNativeScriptDynamic().bootstrapModule(AppModule); 10 | -------------------------------------------------------------------------------- /demo/app/main-page.ts: -------------------------------------------------------------------------------- 1 | import { EventData, Page } from '@nativescript/core'; 2 | 3 | import { HelloWorldModel } from './main-view-model'; 4 | const c = new HelloWorldModel(); 5 | // Event handler for Page 'loaded' event attached in main-page.xml 6 | export function pageLoaded(args: EventData) { 7 | // Get the event sender 8 | let page = args.object; 9 | page.bindingContext = c; 10 | } 11 | -------------------------------------------------------------------------------- /src/android/callback/callback.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | /** 3 | * Interface for all callbacks used with Auth0 API clients 4 | */ 5 | export interface Callback { 6 | /** 7 | * Method called on Auth0 API request failure 8 | * 9 | * @param error The reason of the failure 10 | */ 11 | onFailure(error: U): any; 12 | } 13 | -------------------------------------------------------------------------------- /src/android/callback/callback.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | 3 | /** 4 | * Interface for all callbacks used with Auth0 API clients 5 | */ 6 | export interface Callback { 7 | 8 | /** 9 | * Method called on Auth0 API request failure 10 | * 11 | * @param error The reason of the failure 12 | */ 13 | onFailure(error: U); 14 | } 15 | -------------------------------------------------------------------------------- /demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth0-demo", 3 | "main": "./app/app.ts", 4 | "dependencies": { 5 | "@nativescript/core": "*", 6 | "@nativescript/theme": "*", 7 | "nativescript-auth0": "file:../src" 8 | }, 9 | "devDependencies": { 10 | "@nativescript/android": "~8.2.0", 11 | "@nativescript/ios": "~8.2.0", 12 | "@nativescript/webpack": "~5.0.0", 13 | "typescript": "~4.5.5" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/android/auth0Exception.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Base Exception for any error found during a request to Auth0's API 3 | */ 4 | export declare class Auth0Exception extends Error { 5 | constructor(message?: string); 6 | static readonly UNKNOWN_ERROR: string; 7 | static readonly NON_JSON_ERROR: string; 8 | static readonly EMPTY_BODY_ERROR: string; 9 | static readonly EMPTY_RESPONSE_BODY_DESCRIPTION: string; 10 | } 11 | -------------------------------------------------------------------------------- /src/android/provider/flagChecker.d.ts: -------------------------------------------------------------------------------- 1 | export declare class FlagChecker { 2 | /** 3 | * Helper method to check that a given value contains a specific flag. 4 | * 5 | * @param value the value to check 6 | * @param flagToCheck the required flag 7 | * @return true if the flag is present in the value, false otherwise. 8 | */ 9 | static hasFlag(value: number, flagToCheck: number): boolean; 10 | } 11 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with XCode 8 you need to specify your development team. 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /src/ios/transactionStore.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthTransaction } from './authTransaction'; 2 | export declare class TransactionStore { 3 | static shared: TransactionStore; 4 | private _current?; 5 | get current(): AuthTransaction; 6 | resume(url: NSURL, options: NSDictionary): boolean; 7 | store(transaction: AuthTransaction): void; 8 | cancel(transaction: AuthTransaction): void; 9 | clear(): void; 10 | } 11 | -------------------------------------------------------------------------------- /demo-vue/README.md: -------------------------------------------------------------------------------- 1 | # NativeScript-Vue Application 2 | 3 | > A native application built with NativeScript-Vue 4 | 5 | ## Usage 6 | 7 | ``` bash 8 | # Install dependencies 9 | npm install 10 | 11 | # Build for production 12 | tns build --bundle 13 | 14 | # Build, watch for changes and debug the application 15 | tns debug --bundle 16 | 17 | # Build, watch for changes and run the application 18 | tns run --bundle 19 | ``` -------------------------------------------------------------------------------- /demo-angular/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "cli": { 6 | "defaultCollection": "@nativescript/schematics" 7 | }, 8 | "projects": { 9 | "blank": { 10 | "root": "", 11 | "sourceRoot": "src", 12 | "projectType": "application", 13 | "prefix": "ns" 14 | } 15 | }, 16 | "defaultProject": "blank" 17 | } 18 | -------------------------------------------------------------------------------- /src/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // compile 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | 9 | 10 | 11 | 12 | android { 13 | defaultConfig { 14 | generatedDensities = [] 15 | applicationId = "org.nativescript.auth0demo" 16 | } 17 | aaptOptions { 18 | additionalParameters "--no-version-vectors" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/android/callback/baseCallback.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { Callback } from './callback'; 3 | /** 4 | * Callback that receives a single value on success. 5 | */ 6 | export interface BaseCallback extends Callback { 7 | /** 8 | * Method called on success with the payload or null. 9 | * 10 | * @param payload Request payload or null 11 | */ 12 | onSuccess(payload: T): any; 13 | } 14 | -------------------------------------------------------------------------------- /src/android/callback/baseCallback.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { Callback } from './callback'; 3 | 4 | /** 5 | * Callback that receives a single value on success. 6 | */ 7 | export interface BaseCallback extends Callback { 8 | 9 | /** 10 | * Method called on success with the payload or null. 11 | * 12 | * @param payload Request payload or null 13 | */ 14 | onSuccess(payload: T); 15 | } 16 | -------------------------------------------------------------------------------- /src/android/provider/algorithmHelper.d.ts: -------------------------------------------------------------------------------- 1 | export declare class AlgorithmHelper { 2 | private static readonly TAG; 3 | private static readonly US_ASCII; 4 | private static readonly SHA_256; 5 | private getBase64String; 6 | getASCIIBytes(value: string): androidNative.Array; 7 | getSHA256(input: androidNative.Array): androidNative.Array; 8 | generateCodeVerifier(): string; 9 | generateCodeChallenge(codeVerifier: string): string; 10 | } 11 | -------------------------------------------------------------------------------- /demo/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("@nativescript/webpack"); 2 | 3 | module.exports = (env) => { 4 | // handle auth0 activity for android (appComponents are only handled for android) 5 | env.appComponents = (env.appComponents || []).concat([ 6 | "nativescript-auth0/android/provider/redirectActivity", 7 | ]); 8 | 9 | webpack.init(env); 10 | 11 | // Learn how to customize: 12 | // https://docs.nativescript.org/webpack 13 | 14 | return webpack.resolveConfig(); 15 | }; 16 | -------------------------------------------------------------------------------- /src/typings/a0ChallengeGenerator.ios.d.ts: -------------------------------------------------------------------------------- 1 | declare class A0SHA256ChallengeGenerator extends NSObject { 2 | 3 | static alloc(): A0SHA256ChallengeGenerator; // inherited from NSObject 4 | 5 | static new(): A0SHA256ChallengeGenerator; // inherited from NSObject 6 | 7 | readonly challenge: string; 8 | 9 | readonly method: string; 10 | 11 | readonly verifier: string; 12 | 13 | constructor(o: { verifier: NSData; }); 14 | 15 | initWithVerifier(verifier: NSData): this; 16 | } -------------------------------------------------------------------------------- /demo-angular/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("@nativescript/webpack"); 2 | 3 | module.exports = (env) => { 4 | // handle auth0 activity for android (appComponents are only handled for android) 5 | env.appComponents = (env.appComponents || []).concat([ 6 | "nativescript-auth0/android/provider/redirectActivity", 7 | ]); 8 | webpack.init(env); 9 | 10 | // Learn how to customize: 11 | // https://docs.nativescript.org/webpack 12 | 13 | return webpack.resolveConfig(); 14 | }; 15 | -------------------------------------------------------------------------------- /src/android/provider/callbackHelper.d.ts: -------------------------------------------------------------------------------- 1 | import Uri = android.net.Uri; 2 | export declare abstract class CallbackHelper { 3 | private static readonly TAG; 4 | /** 5 | * Generates the callback Uri for the given domain. 6 | * 7 | * @return the callback Uri. 8 | */ 9 | static getCallbackUri(scheme: string, packageName: string, domain: string): string; 10 | static getValuesFromUri(uri: Uri): { 11 | [key: string]: string; 12 | }; 13 | private static asMap; 14 | } 15 | -------------------------------------------------------------------------------- /src/android/provider/flagChecker.ts: -------------------------------------------------------------------------------- 1 | export class FlagChecker { 2 | 3 | /** 4 | * Helper method to check that a given value contains a specific flag. 5 | * 6 | * @param value the value to check 7 | * @param flagToCheck the required flag 8 | * @return true if the flag is present in the value, false otherwise. 9 | */ 10 | public static hasFlag(value: number, flagToCheck: number): boolean { 11 | return ((value & flagToCheck) === flagToCheck); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from "@angular/core"; 2 | import { Routes } from "@angular/router"; 3 | import { NativeScriptRouterModule } from "@nativescript/angular"; 4 | 5 | import { HomeComponent } from "./home.component"; 6 | 7 | const routes: Routes = [ 8 | { path: "", component: HomeComponent } 9 | ]; 10 | 11 | @NgModule({ 12 | imports: [NativeScriptRouterModule.forChild(routes)], 13 | exports: [NativeScriptRouterModule] 14 | }) 15 | export class HomeRoutingModule { } 16 | -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /src/ios/safariAuthenticationSessionCallback.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthTransaction } from './authTransaction'; 2 | export declare class SafariAuthenticationSessionCallback implements AuthTransaction { 3 | state: string | undefined; 4 | authSession: SFAuthenticationSession | undefined; 5 | callback: (result: boolean) => void; 6 | constructor(url: NSURL, schemeURL: string, callback: (result: boolean) => void); 7 | resume(url: NSURL, options: { 8 | [key: string]: any; 9 | }): boolean; 10 | cancel(): void; 11 | } 12 | -------------------------------------------------------------------------------- /demo-angular/.gitignore: -------------------------------------------------------------------------------- 1 | # NativeScript 2 | hooks/ 3 | node_modules/ 4 | platforms/ 5 | 6 | # NativeScript Template 7 | *.js.map 8 | *.js 9 | !webpack.config.js 10 | 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # General 19 | .DS_Store 20 | .AppleDouble 21 | .LSOverride 22 | .idea 23 | .cloud 24 | .project 25 | tmp/ 26 | typings/ 27 | 28 | # Visual Studio Code 29 | .vscode/* 30 | !.vscode/settings.json 31 | !.vscode/tasks.json 32 | !.vscode/launch.json 33 | !.vscode/extensions.json 34 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/iOS/build.xcconfig: -------------------------------------------------------------------------------- 1 | // You can add custom settings here 2 | // for example you can uncomment the following line to force distribution code signing 3 | // CODE_SIGN_IDENTITY = iPhone Distribution 4 | // To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html 5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID; 6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 8 | -------------------------------------------------------------------------------- /src/android/util/telemetry.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Telemetry { 2 | static readonly HEADER_NAME: string; 3 | private static readonly NAME_KEY; 4 | private static readonly VERSION_KEY; 5 | private static readonly LIB_VERSION_KEY; 6 | private readonly name; 7 | private readonly version; 8 | private readonly libraryVersion; 9 | constructor(name: string, version: string, libraryVersion?: string); 10 | getName(): string; 11 | getVersion(): string; 12 | getLibraryVersion(): string | undefined; 13 | getValue(): string; 14 | } 15 | -------------------------------------------------------------------------------- /demo-angular/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from "@angular/core"; 2 | import { Routes } from "@angular/router"; 3 | import { NativeScriptRouterModule } from "@nativescript/angular"; 4 | 5 | const routes: Routes = [ 6 | { path: "", redirectTo: "/home", pathMatch: "full" }, 7 | { path: "home", loadChildren: () => import('./home/home.module').then(m => m.HomeModule) } 8 | ]; 9 | 10 | @NgModule({ 11 | imports: [NativeScriptRouterModule.forRoot(routes)], 12 | exports: [NativeScriptRouterModule] 13 | }) 14 | export class AppRoutingModule { } 15 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptCommonModule } from "@nativescript/angular"; 3 | 4 | import { HomeRoutingModule } from "./home-routing.module"; 5 | import { HomeComponent } from "./home.component"; 6 | 7 | @NgModule({ 8 | imports: [ 9 | NativeScriptCommonModule, 10 | HomeRoutingModule 11 | ], 12 | declarations: [ 13 | HomeComponent 14 | ], 15 | schemas: [ 16 | NO_ERRORS_SCHEMA 17 | ] 18 | }) 19 | export class HomeModule { } 20 | -------------------------------------------------------------------------------- /src/ios/silentSafariViewController.d.ts: -------------------------------------------------------------------------------- 1 | declare class SilentSafariViewController extends SFSafariViewController implements SFSafariViewControllerDelegate { 2 | onResult: (result: boolean) => void; 3 | static alloc(): SilentSafariViewController; 4 | initWithURLCallback(URL: NSURL, callback: (result: boolean) => void): this; 5 | safariViewController(controller: SFSafariViewController, didLoadSuccessfully: boolean): void; 6 | static ObjCProtocols: { 7 | prototype: SFSafariViewControllerDelegate; 8 | }[]; 9 | } 10 | export { SilentSafariViewController }; 11 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-Center.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-Center@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-Center@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /src/ios/utils.d.ts: -------------------------------------------------------------------------------- 1 | export declare function jsArrayToNSArray(arr: T[]): NSArray; 2 | export declare function nsArrayToJSArray(a: NSArray): Array; 3 | export declare function a0_encodeBase64URLSafe(dataOrString: NSData | string): string; 4 | export declare function a0_url(domain: string): NSURL; 5 | export declare function a0_fragmentValues(components: NSURLComponents): { 6 | [key: string]: string; 7 | }; 8 | export declare function a0_queryValues(components: NSURLComponents): { 9 | [key: string]: string; 10 | }; 11 | export declare const invokeOnRunLoop: (func: any) => void; 12 | -------------------------------------------------------------------------------- /demo-angular/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; 2 | import { NativeScriptModule } from "@nativescript/angular"; 3 | 4 | import { AppRoutingModule } from "./app-routing.module"; 5 | import { AppComponent } from "./app.component"; 6 | 7 | @NgModule({ 8 | bootstrap: [ 9 | AppComponent 10 | ], 11 | imports: [ 12 | NativeScriptModule, 13 | AppRoutingModule 14 | ], 15 | declarations: [ 16 | AppComponent 17 | ], 18 | schemas: [ 19 | NO_ERRORS_SCHEMA 20 | ] 21 | }) 22 | export class AppModule { } 23 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchScreen-AspectFill.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchScreen-AspectFill@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchScreen-AspectFill@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /src/ios/safariAuthenticationSession.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthSession } from './authSession'; 2 | import { Credentials } from '../common/credentials'; 3 | import { Result } from './result'; 4 | import { Logger } from './logger'; 5 | import { OAuth2Grant } from './oauth2Grant'; 6 | export declare class SafariAuthenticationSession extends AuthSession { 7 | authSession: SFAuthenticationSession | undefined; 8 | readonly authorizeURL: NSURL; 9 | constructor(authorizeURL: NSURL, redirectURL: NSURL, state: string | undefined, handler: OAuth2Grant, finish: (result: Result) => void, logger: Logger | undefined); 10 | } 11 | -------------------------------------------------------------------------------- /src/android/request/internal/voidRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions, HttpResponse } from '@nativescript/core/http'; 2 | import Uri = android.net.Uri; 3 | import { BaseRequest } from './baseRequest'; 4 | import { Auth0Exception } from '../../auth0Exception'; 5 | import { ErrorBuilder } from '../errorBuilder'; 6 | export declare class VoidRequest extends BaseRequest { 7 | private readonly httpMethod; 8 | constructor(url: Uri, httpMethod: string, errorBuilder: ErrorBuilder); 9 | onResponse(response: HttpResponse): void; 10 | protected doBuildRequest(): HttpRequestOptions; 11 | } 12 | -------------------------------------------------------------------------------- /src/typings/auth0jwt.android.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace com { 2 | export namespace auth0 { 3 | export namespace android { 4 | export namespace jwt { 5 | export class Claim extends java.lang.Object { 6 | public asString(): string; 7 | } 8 | export class DecodeException extends java.lang.Exception {} 9 | export class JWT extends java.lang.Object { 10 | constructor(token: string); 11 | public getClaim(claimName: string): Claim; 12 | } 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/android/request/request.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { BaseCallback } from '../callback/baseCallback'; 3 | /** 4 | * Defines a request that can be started 5 | * 6 | * @param the type this request will return on success. 7 | * @param the {@link Auth0Exception} type this request will return on failure. 8 | */ 9 | export interface Request { 10 | /** 11 | * Performs an async HTTP request against Auth0 API 12 | * 13 | * @param callback called either on success or failure 14 | */ 15 | start(callback: BaseCallback): any; 16 | } 17 | -------------------------------------------------------------------------------- /src/android/request/request.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { BaseCallback } from '../callback/baseCallback'; 3 | 4 | /** 5 | * Defines a request that can be started 6 | * 7 | * @param the type this request will return on success. 8 | * @param the {@link Auth0Exception} type this request will return on failure. 9 | */ 10 | export interface Request { 11 | 12 | /** 13 | * Performs an async HTTP request against Auth0 API 14 | * 15 | * @param callback called either on success or failure 16 | */ 17 | start(callback: BaseCallback); 18 | } 19 | -------------------------------------------------------------------------------- /src/android/result/authentication.d.ts: -------------------------------------------------------------------------------- 1 | import { UserInfo } from '../../common/userInfo'; 2 | import { Credentials } from '../../common/credentials'; 3 | /** 4 | * The result of a successful authentication against Auth0 5 | * Contains the logged in user's {@link Credentials} and {@link UserProfile}. 6 | * 7 | * @see AuthenticationAPIClient#getProfileAfter(AuthenticationRequest) 8 | */ 9 | export declare class Authentication { 10 | private readonly profile; 11 | private readonly credentials; 12 | constructor(profile: UserInfo, credentials: Credentials); 13 | getProfile(): UserInfo; 14 | getCredentials(): Credentials; 15 | } 16 | -------------------------------------------------------------------------------- /demo-angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * NativeScript Polyfills 3 | */ 4 | 5 | // Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame) 6 | import '@nativescript/core/globals'; 7 | // Install @nativescript/angular specific polyfills 8 | import '@nativescript/angular/polyfills'; 9 | 10 | /** 11 | * Zone.js and patches 12 | */ 13 | // Add pre-zone.js patches needed for the NativeScript platform 14 | import '@nativescript/zone-js/dist/pre-zone-polyfills'; 15 | 16 | // Zone JS is required by default for Angular itself 17 | import 'zone.js'; 18 | 19 | // Add NativeScript specific Zone JS patches 20 | import '@nativescript/zone-js'; 21 | -------------------------------------------------------------------------------- /src/android/request/internal/authenticationErrorBuilder.d.ts: -------------------------------------------------------------------------------- 1 | import { ErrorBuilder } from '../errorBuilder'; 2 | import { AuthenticationException } from '../../authentication/authenticationException'; 3 | import { Auth0Exception } from '../../auth0Exception'; 4 | export declare class AuthenticationErrorBuilder implements ErrorBuilder { 5 | from(message: string): AuthenticationException; 6 | from(message: string, exception: Auth0Exception): AuthenticationException; 7 | from(values: { 8 | [key: string]: any; 9 | }): AuthenticationException; 10 | from(payload: string, statusCode: number): AuthenticationException; 11 | } 12 | -------------------------------------------------------------------------------- /src/android/auth0Exception.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Base Exception for any error found during a request to Auth0's API 3 | */ 4 | export class Auth0Exception extends Error { 5 | 6 | constructor(message?: string) { 7 | super(message); 8 | Object.setPrototypeOf(this, new.target.prototype); 9 | } 10 | 11 | public static readonly UNKNOWN_ERROR: string = "a0.sdk.internal_error.unknown"; 12 | public static readonly NON_JSON_ERROR: string = "a0.sdk.internal_error.plain"; 13 | public static readonly EMPTY_BODY_ERROR: string = "a0.sdk.internal_error.empty"; 14 | public static readonly EMPTY_RESPONSE_BODY_DESCRIPTION: string = "Empty response body"; 15 | } 16 | -------------------------------------------------------------------------------- /src/ios/handlers.d.ts: -------------------------------------------------------------------------------- 1 | import { Response } from './response'; 2 | import { AuthenticationError } from './authenticationError'; 3 | import { Result } from './result'; 4 | import { JSONObjectPayload } from '../common/jsonObjectPayload'; 5 | export declare function plainJson(response: Response, callback: (result: Result<{ 6 | [key: string]: any; 7 | }>) => void): void; 8 | export declare function authenticationObject(TClass: JSONObjectPayload): (response: Response, callback: (result: Result) => void) => void; 9 | export declare function noBody(response: Response, callback: (result: Result) => void): void; 10 | -------------------------------------------------------------------------------- /src/common/databaseUser.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Auth0 user created in a Database connection. 3 | * 4 | * @see AuthenticationAPIClient#signUp(String, String, String) 5 | */ 6 | export declare class DatabaseUser { 7 | readonly email: string | undefined; 8 | readonly username: string | undefined; 9 | readonly emailVerified: boolean | undefined; 10 | constructor(email?: string | undefined, username?: string | undefined, emailVerified?: boolean | undefined); 11 | static initWithJson(json: { 12 | [key: string]: any; 13 | }): DatabaseUser; 14 | toJSON(): { 15 | email: string; 16 | username: string; 17 | email_verified: boolean; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /src/ios/auth0Error.d.ts: -------------------------------------------------------------------------------- 1 | export declare const unknownError = "a0.sdk.internal_error.unknown"; 2 | export declare const nonJSONError = "a0.sdk.internal_error.plain"; 3 | export declare const emptyBodyError = "a0.sdk.internal_error.empty"; 4 | /** 5 | Generic representation of Auth0 API errors 6 | - note: It's recommended to use either `AuthenticationError` or `ManagementError` for better error handling 7 | */ 8 | export declare class Auth0Error extends Error { 9 | readonly info: { 10 | [key: string]: any; 11 | }; 12 | constructor(infoOrString?: { 13 | [key: string]: any; 14 | } | string | undefined, statusCode?: number); 15 | get code(): string; 16 | } 17 | -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": ".", 4 | "sourceMap": true, 5 | "declaration": true, 6 | "moduleResolution": "node", 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "noEmitHelpers": false, 10 | "target": "es2019", 11 | "module": "esnext", 12 | "lib": ["es2019", "dom"], 13 | "skipLibCheck": true, 14 | "skipDefaultLibCheck": true, 15 | "baseUrl": ".", 16 | "plugins": [ 17 | { 18 | "transform": "@nativescript/webpack/dist/transformers/NativeClass", 19 | "type": "raw" 20 | } 21 | ] 22 | }, 23 | "exclude": ["node_modules"], 24 | "compileOnSave": false 25 | } 26 | -------------------------------------------------------------------------------- /demo/app/main-page.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/app.gradle: -------------------------------------------------------------------------------- 1 | // Add your native dependencies here: 2 | 3 | // Uncomment to add recyclerview-v7 dependency 4 | //dependencies { 5 | // implementation 'com.android.support:recyclerview-v7:+' 6 | //} 7 | 8 | // If you want to add something to be applied before applying plugins' include.gradle files 9 | // e.g. project.ext.googlePlayServicesVersion = "15.0.1" 10 | // create a file named before-plugins.gradle in the current directory and place it there 11 | 12 | android { 13 | defaultConfig { 14 | minSdkVersion 17 15 | generatedDensities = [] 16 | applicationId = "org.nativescript.auth0demo" 17 | } 18 | aaptOptions { 19 | additionalParameters "--no-version-vectors" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/platforms/android/include.gradle: -------------------------------------------------------------------------------- 1 | /* Include.gradle configuration: http://docs.nativescript.org/plugins/plugins#includegradle-specification */ 2 | 3 | android { 4 | 5 | } 6 | 7 | dependencies { 8 | // Describe plugin native Android dependencies like 9 | // compile "groupName:pluginName:ver" 10 | // EXAMPLE: compile "com.facebook.fresco:fresco:0.9.0+" 11 | def androidXLegacyVersion = "1.0.0" 12 | if (project.hasProperty("androidXLegacy")) { 13 | androidXLegacyVersion = androidXLegacy 14 | } 15 | 16 | implementation "androidx.legacy:legacy-support-v4:$androidXLegacyVersion" 17 | implementation "androidx.browser:browser:1.2.0" 18 | implementation "com.auth0.android:jwtdecode:2.0.0" 19 | } 20 | -------------------------------------------------------------------------------- /demo-angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "es2017", 5 | "experimentalDecorators": true, 6 | "emitDecoratorMetadata": true, 7 | "noEmitHelpers": true, 8 | "noEmitOnError": true, 9 | "skipLibCheck": true, 10 | "lib": [ 11 | "dom", 12 | "es2017" 13 | ], 14 | "baseUrl": ".", 15 | "paths": { 16 | "~/*": [ 17 | "src/*" 18 | ] 19 | }, 20 | "moduleResolution": "node", 21 | "removeComments": false 22 | }, 23 | "files": [ 24 | "./references.d.ts", 25 | "./src/main.ts", 26 | "./src/polyfills.ts" 27 | ], 28 | "include": [ 29 | "../src" 30 | ], 31 | "exclude": [ 32 | "../src/node_modules", 33 | "node_modules", 34 | "platforms" 35 | ] 36 | } -------------------------------------------------------------------------------- /src/android/request/authorizableRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { ParameterizableRequest } from './parameterizableRequest'; 3 | /** 4 | * Interface for a Auth0 request that need Authorization using a JWT. 5 | * 6 | * @param the type this request will return on success. 7 | * @param the {@link Auth0Exception} type this request will return on failure. 8 | */ 9 | export interface AuthorizableRequest extends ParameterizableRequest { 10 | /** 11 | * Set the JWT used in 'Authorization' header value 12 | * 13 | * @param jwt token to send to the API 14 | * @return itself 15 | */ 16 | setBearer(jwt: string): AuthorizableRequest; 17 | } 18 | -------------------------------------------------------------------------------- /src/platforms/ios/README.md: -------------------------------------------------------------------------------- 1 | # iOS permissions and dependencies 2 | 3 | 4 | * (Optional) Use Info.plist to describe any permissions, features or other configuration specifics required or used by your plugin for iOS. 5 | NOTE: The NativeScript CLI will not resolve any contradicting or duplicate entries during the merge. After the plugin is installed, you need to manually resolve such issues. 6 | * (Optional) Use build.xcconfig configuration to describe any plugin the native dependencies. If there are no such, this file can be removed. For more information, see the [build.xcconfig Specification section](http://docs.nativescript.org/plugins/plugins#buildxcconfig-specification). 7 | 8 | 9 | [Read more about nativescript plugins](http://docs.nativescript.org/plugins/plugins) -------------------------------------------------------------------------------- /src/ios/logger.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions, HttpResponse } from '@nativescript/core/http'; 2 | export interface Logger { 3 | trace(request: HttpRequestOptions): any; 4 | trace(response: HttpResponse): any; 5 | trace(url: NSURL, source: string): any; 6 | } 7 | export interface LoggerOutput { 8 | log(message: string): any; 9 | newLine(): any; 10 | } 11 | export declare class DefaultLogger implements Logger { 12 | readonly output: LoggerOutput; 13 | constructor(output?: LoggerOutput); 14 | trace(request: HttpRequestOptions): any; 15 | trace(response: HttpResponse): any; 16 | trace(url: NSURL, source: string | undefined): any; 17 | private traceRequest; 18 | private traceResponse; 19 | private traceUrl; 20 | } 21 | -------------------------------------------------------------------------------- /src/platforms/android/README.md: -------------------------------------------------------------------------------- 1 | # Android permissions and dependencies 2 | 3 | * (Optional) Use AndroidManifest.xml to describe any permissions, features or other configuration specifics required or used by your plugin for Android. 4 | NOTE: The NativeScript CLI will not resolve any contradicting or duplicate entries during the merge. After the plugin is installed, you need to manually resolve such issues. 5 | 6 | * (Optional) Use include.gradle configuration to describe any native dependencies. If there are no such, this file can be removed. For more information, see the [include.gradle Specification](http://docs.nativescript.org/plugins/plugins#includegradle-specification) 7 | 8 | 9 | [Read more about nativescript plugins](http://docs.nativescript.org/plugins/plugins) -------------------------------------------------------------------------------- /src/android/request/authorizableRequest.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { ParameterizableRequest } from './parameterizableRequest'; 3 | 4 | /** 5 | * Interface for a Auth0 request that need Authorization using a JWT. 6 | * 7 | * @param the type this request will return on success. 8 | * @param the {@link Auth0Exception} type this request will return on failure. 9 | */ 10 | export interface AuthorizableRequest extends ParameterizableRequest { 11 | 12 | /** 13 | * Set the JWT used in 'Authorization' header value 14 | * 15 | * @param jwt token to send to the API 16 | * @return itself 17 | */ 18 | setBearer(jwt: string): AuthorizableRequest; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .history 3 | .idea 4 | .DS_Store 5 | *.esm.json 6 | *.js 7 | *.js.map 8 | *.log 9 | src/*.d.ts 10 | !src/index.d.ts 11 | !src/references.d.ts 12 | !src/scripts/*.js 13 | !seed-tests/*.js 14 | seed-tests/seed-copy/**/*.* 15 | seed-tests/seed-copy-new-git-repo/**/*.* 16 | !demo/karma.conf.js 17 | !demo/webpack.config.js 18 | !demo/webpack.custom.config.js 19 | !demo/app/tests/*.js 20 | demo/*.d.ts 21 | !demo/references.d.ts 22 | demo/.tmp_backup 23 | demo/lib 24 | demo/platforms 25 | node_modules 26 | publish/src 27 | publish/package 28 | publish/package-lock.json 29 | demo/report/report.html 30 | demo/report/stats.json 31 | !demo-vue/babel.config.js 32 | !demo-vue/webpack.config.js 33 | !demo-vue/webpack.custom.config.js 34 | package-lock.json 35 | *.tgz 36 | -------------------------------------------------------------------------------- /src/ios/response.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions, HttpResponse, HttpContent } from '@nativescript/core/http'; 2 | import { Auth0Error } from './auth0Error'; 3 | export declare function json(data: HttpContent | undefined): T | undefined; 4 | export declare function string(data: HttpContent | undefined): string | undefined; 5 | export declare class Response { 6 | readonly data: HttpContent | undefined; 7 | readonly request: HttpRequestOptions | undefined; 8 | readonly response: HttpResponse | undefined; 9 | readonly error: Error | undefined; 10 | readonly EClass: typeof Auth0Error; 11 | constructor(data: HttpContent | undefined, request: HttpRequestOptions | undefined, response: HttpResponse | undefined, error: Error | undefined, EClass: typeof Auth0Error); 12 | result(): any | undefined; 13 | } 14 | -------------------------------------------------------------------------------- /src/ios/responseType.ts: -------------------------------------------------------------------------------- 1 | export class ResponseType { 2 | public readonly rawValue: number; 3 | 4 | public constructor(rawValue: number) { 5 | this.rawValue = rawValue; 6 | } 7 | 8 | public static readonly token = new ResponseType(1 << 0); 9 | public static readonly idToken = new ResponseType(1 << 1); 10 | public static readonly code = new ResponseType(1 << 2); 11 | 12 | public get label(): string | null { 13 | switch (this.rawValue) { 14 | case ResponseType.token.rawValue: 15 | return "token"; 16 | case ResponseType.idToken.rawValue: 17 | return "id_token"; 18 | case ResponseType.code.rawValue: 19 | return "code"; 20 | default: 21 | return null; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/scripts/build-native.js: -------------------------------------------------------------------------------- 1 | const { exec } = require('child_process'); 2 | const semver = require('semver'); 3 | 4 | exec('tns --version', (err, stdout, stderr) => { 5 | if (err) { 6 | // node couldn't execute the command 7 | console.log(`tns --version err: ${err}`); 8 | return; 9 | } 10 | 11 | const tnsVersion = semver.major(stdout); 12 | 13 | // execute 'tns plugin build' for {N} version > 4. This command builds .aar in platforms/android folder. 14 | if (tnsVersion >= 4) { 15 | console.log(`executing 'tns plugin build'`); 16 | exec('tns plugin build', (err, stdout, stderr) => { 17 | if (err) { 18 | // node couldn't execute the command 19 | console.log(`${err}`); 20 | return; 21 | } 22 | }); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /demo-vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth0-demo-vue", 3 | "main": "main", 4 | "dependencies": { 5 | "@nativescript/core": "7.0.0", 6 | "@nativescript/theme": "^3.0.0", 7 | "@nativescript/webpack": "3.0.0", 8 | "@vue/devtools": "^5.0.1", 9 | "nativescript-auth0": "file:../src", 10 | "nativescript-socketio": "^3.3.1", 11 | "nativescript-toasty": "^2.0.0", 12 | "nativescript-vue-devtools": "^1.2.0", 13 | "nativescript-vue": "^2.8.1" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "~7.1.0", 17 | "@babel/preset-env": "~7.1.0", 18 | "@nativescript/android": "7.0.0", 19 | "@nativescript/ios": "7.0.3", 20 | "babel-loader": "~8.0.0", 21 | "nativescript-vue-template-compiler": "~2.8.1", 22 | "sass": "^1.26.11", 23 | "typescript": "3.9.7", 24 | "vue": "^2.6.10", 25 | "vue-loader": "~15.4.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/android/authentication/passwordStrengthErrorParser.d.ts: -------------------------------------------------------------------------------- 1 | export declare class PasswordStrengthErrorParser { 2 | private static readonly RULE_TYPE_LENGTH_AT_LEAST; 3 | private static readonly RULE_TYPE_CONTAINS_AT_LEAST; 4 | private static readonly RULE_TYPE_SHOULD_CONTAIN; 5 | private static readonly RULE_TYPE_IDENTICAL_CHARS; 6 | private static readonly KEY_RULES; 7 | private static readonly KEY_CODE; 8 | private static readonly KEY_VERIFIED; 9 | private static readonly KEY_FORMAT; 10 | private static readonly KEY_ITEMS; 11 | private static readonly KEY_MESSAGE; 12 | private description; 13 | constructor(descriptionMap: { 14 | [key: string]: any; 15 | }); 16 | getDescription(): string; 17 | private parseRules; 18 | private asLengthAtLeast; 19 | private asContainsCharset; 20 | private asIdenticalChars; 21 | } 22 | -------------------------------------------------------------------------------- /src/android/provider/customTabsOptions.d.ts: -------------------------------------------------------------------------------- 1 | import Context = android.content.Context; 2 | import Intent = android.content.Intent; 3 | import Parcel = android.os.Parcel; 4 | import Parcelable = android.os.Parcelable; 5 | import CustomTabsSession = androidx.browser.customtabs.CustomTabsSession; 6 | /** 7 | * Holder for Custom Tabs customization options. Use {@link CustomTabsOptions#newBuilder()} to begin. 8 | */ 9 | declare class CustomTabsOptions extends java.lang.Object { 10 | private showTitle; 11 | private toolbarColor; 12 | constructor(); 13 | static create(showTitle?: boolean, toolbarColor?: number): CustomTabsOptions; 14 | toIntent(context: Context, session: CustomTabsSession): Intent; 15 | describeContents(): number; 16 | writeToParcel(dest: Parcel, flags: number): void; 17 | static readonly CREATOR: Parcelable.Creator; 18 | } 19 | export { CustomTabsOptions }; 20 | -------------------------------------------------------------------------------- /src/android/request/internal/simpleRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions, HttpResponse } from '@nativescript/core/http'; 2 | import Uri = android.net.Uri; 3 | import { BaseRequest } from './baseRequest'; 4 | import { Auth0Exception } from '../../auth0Exception'; 5 | import { ErrorBuilder } from '../errorBuilder'; 6 | import { ParameterizableRequest } from '../parameterizableRequest'; 7 | import { JSONObjectPayload } from '../../../common/jsonObjectPayload'; 8 | export declare class SimpleRequest extends BaseRequest implements ParameterizableRequest { 9 | private readonly method; 10 | constructor(url: Uri, httpMethod: string, clazz: JSONObjectPayload, errorBuilder: ErrorBuilder); 11 | constructor(url: Uri, httpMethod: string, errorBuilder: ErrorBuilder); 12 | onResponse(response: HttpResponse): void; 13 | protected doBuildRequest(): HttpRequestOptions; 14 | } 15 | -------------------------------------------------------------------------------- /src/android/provider/redirectActivity.ts: -------------------------------------------------------------------------------- 1 | 2 | import Intent = android.content.Intent; 3 | import Bundle = android.os.Bundle; 4 | 5 | import { AuthenticationActivity } from './authenticationActivity'; 6 | 7 | @NativeClass() 8 | @JavaProxy('org.nativescript.auth0.RedirectActivity') 9 | export class RedirectActivity extends android.app.Activity { 10 | 11 | constructor() { 12 | super(); 13 | return global.__native(this); 14 | } 15 | 16 | public onCreate(savedInstanceBundle: Bundle): void { 17 | super.onCreate(savedInstanceBundle); 18 | const intent = new Intent(this, AuthenticationActivity.class); 19 | intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); 20 | if (this.getIntent() != null) { 21 | intent.setData(this.getIntent().getData()); 22 | } 23 | this.startActivity(intent); 24 | this.finish(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /demo/app/main-view-model.ts: -------------------------------------------------------------------------------- 1 | import { Observable } from '@nativescript/core'; 2 | import { Auth0, Credentials, WebAuthException } from 'nativescript-auth0'; 3 | 4 | export class HelloWorldModel extends Observable { 5 | private auth0: Auth0; 6 | public message: string; 7 | 8 | constructor() { 9 | super(); 10 | 11 | this.auth0 = new Auth0('q5atQzi6DgmWBpHWRJbd7MBNa5eLBPRp', 'nativescript.auth0.com'); 12 | this.message = ''; 13 | } 14 | 15 | onTap() { 16 | this.auth0.webAuthentication({ 17 | scope: 'openid offline_access' 18 | }).then((result: Credentials) => { 19 | this.set('message', JSON.stringify(result, null, ' ')); 20 | console.log(result); 21 | }).catch((error: Error | WebAuthException) => { 22 | this.set('message', JSON.stringify(error, null, ' ')); 23 | console.log(error.stack); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/android/request/errorBuilder.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | export interface ErrorBuilder { 3 | /** 4 | * @param message the description 5 | * @return a new exception instance 6 | */ 7 | from(message: string): U; 8 | /** 9 | * @param message the description 10 | * @param exception the exception raised. 11 | * @return a new exception instance 12 | */ 13 | from(message: string, exception: Auth0Exception): U; 14 | /** 15 | * @param values the payload values 16 | * @return a new exception instance 17 | */ 18 | from(values: { 19 | [key: string]: any; 20 | }): U; 21 | /** 22 | * @param payload the String payload from the response. 23 | * @param statusCode the http status code. 24 | * @return a new exception instance 25 | */ 26 | from(payload: string, statusCode: number): U; 27 | } 28 | -------------------------------------------------------------------------------- /src/ios/safariSession.d.ts: -------------------------------------------------------------------------------- 1 | import { OAuth2Grant } from './oauth2Grant'; 2 | import { AuthSession } from './authSession'; 3 | import { Result } from './result'; 4 | import { Credentials } from '../common/credentials'; 5 | import { Logger } from './logger'; 6 | export declare class SafariSessionDelegate extends NSObject { 7 | static ObjCProtocols: { 8 | prototype: SFSafariViewControllerDelegate; 9 | }[]; 10 | private _owner; 11 | static initWithOwner(owner: WeakRef): SafariSessionDelegate; 12 | safariViewControllerDidFinish(controller: SFSafariViewController): void; 13 | } 14 | export declare class SafariSession extends AuthSession { 15 | controller: WeakRef; 16 | private _delegate; 17 | constructor(controller: SFSafariViewController, redirectURL: NSURL, state: string | undefined, handler: OAuth2Grant, finish: (result: Result) => void, logger: Logger | undefined); 18 | } 19 | -------------------------------------------------------------------------------- /src/android/request/errorBuilder.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | 3 | export interface ErrorBuilder { 4 | 5 | /** 6 | * @param message the description 7 | * @return a new exception instance 8 | */ 9 | from(message: string): U; 10 | 11 | /** 12 | * @param message the description 13 | * @param exception the exception raised. 14 | * @return a new exception instance 15 | */ 16 | from(message: string, exception: Auth0Exception): U; 17 | 18 | /** 19 | * @param values the payload values 20 | * @return a new exception instance 21 | */ 22 | from(values: { [key: string]: any }): U; 23 | 24 | /** 25 | * @param payload the String payload from the response. 26 | * @param statusCode the http status code. 27 | * @return a new exception instance 28 | */ 29 | from(payload: string, statusCode: number): U; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 11 | 14 | 15 | 16 | 19 | 20 | 23 | -------------------------------------------------------------------------------- /demo-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auth0-demo-angular", 3 | "main": "./src/main.ts", 4 | "dependencies": { 5 | "@angular/animations": "~13.2.0", 6 | "@angular/common": "~13.2.0", 7 | "@angular/compiler": "~13.2.0", 8 | "@angular/core": "~13.2.0", 9 | "@angular/forms": "~13.2.0", 10 | "@angular/platform-browser-dynamic": "~13.2.0", 11 | "@angular/platform-browser": "~13.2.0", 12 | "@angular/router": "~13.2.0", 13 | "@nativescript/angular": "^13.0.0", 14 | "@nativescript/core": "*", 15 | "@nativescript/theme": "*", 16 | "nativescript-auth0": "file:../src", 17 | "reflect-metadata": "~0.1.13", 18 | "rxjs": "~7.5.0", 19 | "zone.js": "~0.11.1" 20 | }, 21 | "devDependencies": { 22 | "@angular-devkit/build-angular": "~13.2.0", 23 | "@angular/compiler-cli": "~13.2.0", 24 | "@nativescript/android": "~8.2.0", 25 | "@nativescript/ios": "~8.2.0", 26 | "@nativescript/webpack": "~5.0.0", 27 | "@ngtools/webpack": "~13.2.0", 28 | "typescript": "~4.5.5" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "esnext", 5 | "moduleResolution": "node", 6 | "declaration": false, 7 | "removeComments": false, 8 | "noLib": false, 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "lib": [ 12 | "es2017", 13 | "dom", 14 | ], 15 | "pretty": true, 16 | "allowUnreachableCode": false, 17 | "allowUnusedLabels": false, 18 | "noEmitHelpers": true, 19 | "noEmitOnError": false, 20 | "noImplicitAny": false, 21 | "noImplicitReturns": true, 22 | "noImplicitUseStrict": false, 23 | "noFallthroughCasesInSwitch": true, 24 | "baseUrl": ".", 25 | "paths": { 26 | "~/*": [ 27 | "app/*" 28 | ] 29 | } 30 | }, 31 | "exclude": [ 32 | "node_modules", 33 | "platforms" 34 | ], 35 | "compileOnSave": false 36 | } 37 | -------------------------------------------------------------------------------- /src/ios/loggable.d.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from './logger'; 2 | export interface Loggable { 3 | logger: Logger | undefined; 4 | } 5 | export declare class LoggableExtension { 6 | /** 7 | Turn on Auth0.swift debug logging of HTTP requests and OAuth2 flow (iOS only) with a custom logger. 8 | 9 | - parameter logger: logger used to print log statements 10 | - note: By default all logging is **disabled** 11 | - important: Logging should be turned on/off **before** making request to Auth0 for the flag to take effect. 12 | */ 13 | static using(loggable: Loggable, logger: Logger): Loggable; 14 | /** 15 | Turn on/off Auth0.swift debug logging of HTTP requests and OAuth2 flow (iOS only). 16 | 17 | - parameter enabled: optional flag to turn on/off logging 18 | - note: By default all logging is **disabled** 19 | - important: Logging should be turned on/off **before** making request to Auth0 for the flag to take effect. 20 | */ 21 | static logging(loggable: Loggable, enabled: boolean): Loggable; 22 | } 23 | -------------------------------------------------------------------------------- /src/android/result/authentication.ts: -------------------------------------------------------------------------------- 1 | import { UserInfo } from '../../common/userInfo'; 2 | import { Credentials } from '../../common/credentials'; 3 | 4 | /** 5 | * The result of a successful authentication against Auth0 6 | * Contains the logged in user's {@link Credentials} and {@link UserProfile}. 7 | * 8 | * @see AuthenticationAPIClient#getProfileAfter(AuthenticationRequest) 9 | */ 10 | export class Authentication { 11 | 12 | private readonly profile: UserInfo; 13 | private readonly credentials: Credentials; 14 | 15 | constructor(profile: UserInfo, credentials: Credentials) { 16 | if (profile == null) { 17 | throw new Error("profile must be non-null"); 18 | } 19 | if (credentials == null) { 20 | throw new Error("credentials must be non-null"); 21 | } 22 | this.profile = profile; 23 | this.credentials = credentials; 24 | } 25 | 26 | public getProfile(): UserInfo { 27 | return this.profile; 28 | } 29 | 30 | public getCredentials(): Credentials { 31 | return this.credentials; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/android/authentication/request/tokenRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthenticationException } from '../authenticationException'; 2 | import { Request } from '../../request/request'; 3 | import { ParameterizableRequest } from '../../request/parameterizableRequest'; 4 | import { BaseCallback } from '../../callback/baseCallback'; 5 | import { Credentials } from '../../../common/credentials'; 6 | /** 7 | * Auth Request to obtain tokens using OAuth2 {@literal /oauth/token} method 8 | */ 9 | export declare class TokenRequest implements Request { 10 | private static readonly OAUTH_CODE_VERIFIER_KEY; 11 | private readonly request; 12 | constructor(request: ParameterizableRequest); 13 | /** 14 | * Adds the code verifier to the request (Public Clients) 15 | * 16 | * @param codeVerifier the code verifier used to generate the challenge sent to /authorize. 17 | * @return itself 18 | */ 19 | setCodeVerifier(codeVerifier: string): TokenRequest; 20 | start(callback: BaseCallback): void; 21 | } 22 | -------------------------------------------------------------------------------- /src/android/provider/authCallback.d.ts: -------------------------------------------------------------------------------- 1 | import Dialog = android.app.Dialog; 2 | import { AuthenticationException } from '../authentication/authenticationException'; 3 | import { Credentials } from '../../common/credentials'; 4 | /** 5 | * Callback called on success/failure of an Identity Provider authentication. 6 | * Only one of the success or failure methods will be called for a single authentication request. 7 | */ 8 | export interface AuthCallback { 9 | /** 10 | * Called when the failure reason is displayed in a {@link android.app.Dialog}. 11 | * 12 | * @param dialog error dialog 13 | */ 14 | onFailure(dialog: Dialog): any; 15 | /** 16 | * Called with an AuthenticationException that describes the error. 17 | * 18 | * @param exception cause of the error 19 | */ 20 | onFailure(exception: AuthenticationException): any; 21 | /** 22 | * Called when the authentication is successful using web authentication against Auth0 23 | * 24 | * @param credentials Auth0 credentials information (id_token, refresh_token, etc). 25 | */ 26 | onSuccess(credentials: Credentials): any; 27 | } 28 | -------------------------------------------------------------------------------- /src/ios/safariAuthenticationSessionCallback.ts: -------------------------------------------------------------------------------- 1 | import { AuthTransaction } from './authTransaction'; 2 | import { TransactionStore } from './transactionStore'; 3 | 4 | export class SafariAuthenticationSessionCallback implements AuthTransaction { 5 | 6 | public state: string | undefined; 7 | public authSession: SFAuthenticationSession | undefined; 8 | public callback: (result: boolean) => void = () => {}; 9 | 10 | constructor(url: NSURL, schemeURL: string, callback: (result: boolean) => void) { 11 | this.callback = callback; 12 | this.authSession = new SFAuthenticationSession({ 13 | URL: url, 14 | callbackURLScheme: schemeURL, 15 | completionHandler: (url, error) => { 16 | this.callback(url != null); 17 | TransactionStore.shared.clear(); 18 | } 19 | }); 20 | this.authSession.start(); 21 | } 22 | 23 | public resume(url: NSURL, options: { [key: string]: any }): boolean { 24 | this.callback(true); 25 | return true; 26 | } 27 | 28 | public cancel() { 29 | this.callback(false); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/android/provider/authCallback.ts: -------------------------------------------------------------------------------- 1 | 2 | import Dialog = android.app.Dialog; 3 | 4 | import { AuthenticationException } from '../authentication/authenticationException'; 5 | import { Credentials } from '../../common/credentials'; 6 | 7 | /** 8 | * Callback called on success/failure of an Identity Provider authentication. 9 | * Only one of the success or failure methods will be called for a single authentication request. 10 | */ 11 | export interface AuthCallback { 12 | 13 | /** 14 | * Called when the failure reason is displayed in a {@link android.app.Dialog}. 15 | * 16 | * @param dialog error dialog 17 | */ 18 | onFailure(dialog: Dialog); 19 | 20 | /** 21 | * Called with an AuthenticationException that describes the error. 22 | * 23 | * @param exception cause of the error 24 | */ 25 | onFailure(exception: AuthenticationException); 26 | 27 | /** 28 | * Called when the authentication is successful using web authentication against Auth0 29 | * 30 | * @param credentials Auth0 credentials information (id_token, refresh_token, etc). 31 | */ 32 | onSuccess(credentials: Credentials); 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | nativescript-auth0 4 | Copyright (c) 2016, Steve McNiven-Scott 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/ios/transactionStore.ts: -------------------------------------------------------------------------------- 1 | import { AuthTransaction } from './authTransaction'; 2 | 3 | /// Keeps track of current Auth Transaction 4 | export class TransactionStore { 5 | public static shared = new TransactionStore(); 6 | 7 | private _current?: AuthTransaction; 8 | 9 | public get current(): AuthTransaction { 10 | return this._current; 11 | } 12 | 13 | public resume(url: NSURL, options: NSDictionary): boolean { 14 | let resumed = (this._current != null) ? this._current.resume(url, options) : false; 15 | if (resumed != null) { 16 | this._current = undefined; 17 | } 18 | return resumed; 19 | } 20 | 21 | public store(transaction: AuthTransaction) { 22 | if (this._current != null) { 23 | this._current.cancel(); 24 | } 25 | this._current = transaction; 26 | } 27 | 28 | public cancel(transaction: AuthTransaction) { 29 | transaction.cancel(); 30 | if (this._current != null && this._current.state === transaction.state) { 31 | this._current = undefined; 32 | } 33 | } 34 | 35 | public clear() { 36 | this._current = undefined; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ios/authSession.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthTransaction } from './authTransaction'; 2 | import { Credentials } from '../common/credentials'; 3 | import { Logger } from './logger'; 4 | import { Result } from './result'; 5 | import { OAuth2Grant } from './oauth2Grant'; 6 | export declare class AuthSession implements AuthTransaction { 7 | readonly redirectURL: NSURL; 8 | readonly state: string | undefined; 9 | readonly finish: (result: Result) => void; 10 | readonly handler: OAuth2Grant; 11 | readonly logger: Logger | undefined; 12 | constructor(redirectURL: NSURL, state: string | undefined, handler: OAuth2Grant, finish: (result: Result) => void, logger: Logger | undefined); 13 | /** 14 | Tries to resume (and complete) the OAuth2 session from the received URL 15 | 16 | - parameter url: url received in application's AppDelegate 17 | - parameter options: a dictionary of launch options received from application's AppDelegate 18 | 19 | - returns: `true` if the url completed (successfuly or not) this session, `false` otherwise 20 | */ 21 | resume(url: NSURL, options?: NSDictionary): boolean; 22 | cancel(): void; 23 | private has; 24 | } 25 | -------------------------------------------------------------------------------- /publish/pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCE_DIR=../src; 4 | TO_SOURCE_DIR=src; 5 | PACK_DIR=package; 6 | ROOT_DIR=..; 7 | PUBLISH=--publish 8 | 9 | install(){ 10 | npm i 11 | } 12 | 13 | pack() { 14 | 15 | echo 'Clearing /src and /package...' 16 | node_modules/.bin/rimraf "$TO_SOURCE_DIR" 17 | node_modules/.bin/rimraf "$PACK_DIR" 18 | 19 | # copy src 20 | echo 'Copying src...' 21 | node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR" 22 | 23 | # copy README & LICENSE to src 24 | echo 'Copying README and LICENSE to /src...' 25 | node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE 26 | node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md 27 | 28 | # compile package and copy files required by npm 29 | echo 'Building /src...' 30 | cd "$TO_SOURCE_DIR" 31 | node_modules/.bin/tsc 32 | cd .. 33 | 34 | echo 'Creating package...' 35 | # create package dir 36 | mkdir "$PACK_DIR" 37 | 38 | # create the package 39 | cd "$PACK_DIR" 40 | npm pack ../"$TO_SOURCE_DIR" 41 | 42 | # delete source directory used to create the package 43 | cd .. 44 | node_modules/.bin/rimraf "$TO_SOURCE_DIR" 45 | } 46 | 47 | install && pack -------------------------------------------------------------------------------- /src/common/credentials.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | User's credentials obtained from Auth0. 3 | What values are available depends on what type of Auth request you perfomed, 4 | so if you used WebAuth (`/authorize` call) the `response_type` and `scope` will determine what tokens you get 5 | */ 6 | export declare class Credentials { 7 | readonly accessToken: string | undefined; 8 | readonly tokenType: string | undefined; 9 | readonly expiresIn: number | undefined; 10 | readonly expiresAt: Date | undefined; 11 | readonly refreshToken: string | undefined; 12 | readonly idToken: string | undefined; 13 | readonly scope: string | undefined; 14 | constructor(accessToken?: string | undefined, tokenType?: string | undefined, idToken?: string | undefined, refreshToken?: string | undefined, expiresIn?: number | undefined, expiresAt?: Date | undefined, scope?: string | undefined); 15 | static initWithJson(json: { 16 | [key: string]: any; 17 | }): Credentials; 18 | toJSON(): { 19 | access_token: string; 20 | token_type: string; 21 | id_token: string; 22 | refresh_token: string; 23 | expires_in: number; 24 | expires_at: Date; 25 | scope: string; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /demo-vue/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2017", 4 | "module": "esnext", 5 | "moduleResolution": "node", 6 | "declaration": false, 7 | "removeComments": false, 8 | "noLib": false, 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "lib": [ 12 | "es2017", 13 | "dom" 14 | ], 15 | "pretty": true, 16 | "allowUnreachableCode": false, 17 | "allowUnusedLabels": false, 18 | "noEmitHelpers": true, 19 | "noEmitOnError": false, 20 | "noImplicitAny": false, 21 | "noImplicitReturns": true, 22 | "noImplicitUseStrict": false, 23 | "noFallthroughCasesInSwitch": true, 24 | "baseUrl": ".", 25 | "paths": { 26 | "*": [ 27 | "./node_modules/*" 28 | ], 29 | "~/*": [ 30 | "app/*" 31 | ] 32 | } 33 | }, 34 | "include": [ 35 | "../src", 36 | "**/*" 37 | ], 38 | "exclude": [ 39 | "../src/node_modules", 40 | "node_modules", 41 | "platforms" 42 | ], 43 | "compileOnSave": false 44 | } 45 | -------------------------------------------------------------------------------- /demo-angular/src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from "@angular/core"; 2 | import { Auth0, Credentials, WebAuthException } from 'nativescript-auth0'; 3 | 4 | @Component({ 5 | selector: "Home", 6 | moduleId: module.id, 7 | templateUrl: "./home.component.html" 8 | }) 9 | export class HomeComponent implements OnInit { 10 | private auth0: Auth0; 11 | private _message: string; 12 | 13 | constructor() { 14 | // Use the component constructor to inject providers. 15 | this.auth0 = new Auth0('q5atQzi6DgmWBpHWRJbd7MBNa5eLBPRp', 'nativescript.auth0.com'); 16 | } 17 | 18 | ngOnInit(): void { 19 | // Init your component properties here. 20 | } 21 | 22 | get message(): string { 23 | return this._message; 24 | } 25 | 26 | login() { 27 | this.auth0.webAuthentication({ 28 | scope: 'openid offline_access' 29 | }).then((result: Credentials) => { 30 | this._message = JSON.stringify(result, null, ' '); 31 | console.log(result); 32 | }).catch((error: Error | WebAuthException) => { 33 | this._message = JSON.stringify(error, null, ' '); 34 | console.log(error.stack); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/android/request/internal/voidRequest.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions, HttpResponse } from '@nativescript/core/http'; 2 | 3 | import Uri = android.net.Uri; 4 | 5 | import { BaseRequest } from './baseRequest'; 6 | import { Auth0Exception } from '../../auth0Exception'; 7 | import { ErrorBuilder } from '../errorBuilder'; 8 | 9 | export class VoidRequest extends BaseRequest { 10 | 11 | private readonly httpMethod: string; 12 | 13 | constructor(url: Uri, httpMethod: string, errorBuilder: ErrorBuilder) { 14 | super(url, { initWithJson: () => null }, errorBuilder); 15 | this.httpMethod = httpMethod; 16 | } 17 | 18 | public onResponse(response: HttpResponse): void { 19 | if (response.statusCode >= 400) { 20 | this.postOnFailure(this.parseUnsuccessfulResponse(response)); 21 | return; 22 | } 23 | 24 | this.postOnSuccess(null); 25 | } 26 | 27 | protected doBuildRequest(): HttpRequestOptions { 28 | const body = this.buildBody(); 29 | return Object.assign( 30 | {}, 31 | this.newRequestOptions(this.httpMethod), 32 | { 33 | content: body 34 | } 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/auth0-common.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from './common/credentials'; 2 | import { UserInfo } from './common/userInfo'; 3 | 4 | export enum ResponseType { 5 | CODE = 1, 6 | TOKEN = 2, 7 | ID_TOKEN = 4 8 | } 9 | 10 | export interface WebAuthOptions { 11 | audience?: string; 12 | connection?: string; 13 | nonce?: string; 14 | responseType?: ResponseType; 15 | scheme?: string; 16 | scope?: string; 17 | state?: string; 18 | parameters?: { [param: string]: string; }; 19 | } 20 | 21 | export class WebAuthException extends Error { 22 | constructor(message) { 23 | super(message); 24 | Object.setPrototypeOf(this, new.target.prototype); 25 | } 26 | } 27 | 28 | export abstract class Auth0Common { 29 | 30 | constructor( 31 | protected clientId: string, 32 | protected domain: string 33 | ) {} 34 | 35 | public abstract webAuthentication(options: WebAuthOptions): Promise; 36 | public abstract renewCredentials(refreshToken: string): Promise; 37 | public abstract revokeRefreshToken(refreshToken: string): Promise; 38 | public abstract getUserInfo(accessToken: string): Promise; 39 | public abstract logoutUser(federated: boolean): Promise; 40 | } 41 | -------------------------------------------------------------------------------- /src/android/provider/authorizeResult.d.ts: -------------------------------------------------------------------------------- 1 | import Intent = android.content.Intent; 2 | export declare class AuthorizeResult { 3 | private static readonly TAG; 4 | private static readonly MISSING_REQUEST_CODE; 5 | private readonly requestCode; 6 | private readonly resultCode; 7 | private readonly intent; 8 | /** 9 | * Wrapper for data received in OnActivityResult / OnNewIntent methods. 10 | * 11 | * @param requestCode the response request code 12 | * @param resultCode the response result code 13 | * @param intent the response intent. 14 | */ 15 | constructor(requestCode: number, resultCode: number, intent?: Intent); 16 | /** 17 | * Wrapper for data received in OnActivityResult / OnNewIntent methods. 18 | * 19 | * @param intent the response intent. 20 | */ 21 | constructor(intent?: Intent); 22 | /** 23 | * Checks if the received data is valid and can be parsed. 24 | * 25 | * @param expectedRequestCode the request code this activity is expecting to receive 26 | * @return whether if the received uri data can be parsed or not. 27 | */ 28 | isValid(expectedRequestCode: number): boolean; 29 | getIntent(): Intent; 30 | getRequestCode(): number; 31 | getResultCode(): number; 32 | } 33 | -------------------------------------------------------------------------------- /src/android/request/parameterizableRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { Request } from './request'; 3 | /** 4 | * Defines a request that can be configured (payload and headers) 5 | * 6 | * @param the type this request will return on success. 7 | * @param the {@link Auth0Exception} type this request will return on failure. 8 | */ 9 | export interface ParameterizableRequest extends Request { 10 | /** 11 | * Add parameters to the request as a Map of Object with the keys as String 12 | * 13 | * @param parameters to send with the request 14 | * @return itself 15 | */ 16 | addParameters(parameters: { 17 | [key: string]: any; 18 | }): ParameterizableRequest; 19 | /** 20 | * Add parameter to the request with a given name 21 | * 22 | * @param name of the parameter 23 | * @param value of the parameter 24 | * @return itself 25 | */ 26 | addParameter(name: string, value: any): ParameterizableRequest; 27 | /** 28 | * Adds an additional header for the request 29 | * 30 | * @param name of the header 31 | * @param value of the header 32 | * @return itself 33 | */ 34 | addHeader(name: string, value: string): ParameterizableRequest; 35 | } 36 | -------------------------------------------------------------------------------- /src/android/request/parameterizableRequest.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../auth0Exception'; 2 | import { Request } from './request'; 3 | 4 | /** 5 | * Defines a request that can be configured (payload and headers) 6 | * 7 | * @param the type this request will return on success. 8 | * @param the {@link Auth0Exception} type this request will return on failure. 9 | */ 10 | export interface ParameterizableRequest extends Request { 11 | 12 | /** 13 | * Add parameters to the request as a Map of Object with the keys as String 14 | * 15 | * @param parameters to send with the request 16 | * @return itself 17 | */ 18 | addParameters(parameters: { [key: string]: any }): ParameterizableRequest; 19 | 20 | /** 21 | * Add parameter to the request with a given name 22 | * 23 | * @param name of the parameter 24 | * @param value of the parameter 25 | * @return itself 26 | */ 27 | addParameter(name: string, value: any): ParameterizableRequest; 28 | 29 | /** 30 | * Adds an additional header for the request 31 | * 32 | * @param name of the header 33 | * @param value of the header 34 | * @return itself 35 | */ 36 | addHeader(name: string, value: string): ParameterizableRequest; 37 | } 38 | -------------------------------------------------------------------------------- /src/android/provider/authenticationActivity.d.ts: -------------------------------------------------------------------------------- 1 | import Context = android.content.Context; 2 | import Intent = android.content.Intent; 3 | import Uri = android.net.Uri; 4 | import Bundle = android.os.Bundle; 5 | import { CustomTabsOptions } from './customTabsOptions'; 6 | import { CustomTabsController } from './customTabsController'; 7 | export declare const EXTRA_CONNECTION_NAME: string; 8 | export declare const EXTRA_AUTHORIZE_URI: string; 9 | export declare const EXTRA_INTENT_LAUNCHED: string; 10 | export declare const EXTRA_CT_OPTIONS: string; 11 | export declare function authenticateUsingBrowser(context: Context, authorizeUri: Uri, options?: CustomTabsOptions): void; 12 | declare class AuthenticationActivity extends android.app.Activity { 13 | private intentLaunched; 14 | private customTabsController; 15 | constructor(); 16 | onNewIntent(intent: Intent): void; 17 | onActivityResult(requestCode: number, resultCode: number, data: Intent): void; 18 | onSaveInstanceState(outState: Bundle): void; 19 | onCreate(savedInstanceState?: Bundle): void; 20 | onResume(): void; 21 | onDestroy(): void; 22 | private launchAuthenticationIntent; 23 | createCustomTabsController(context: Context): CustomTabsController; 24 | deliverAuthenticationResult(result: Intent): void; 25 | } 26 | export { AuthenticationActivity }; 27 | -------------------------------------------------------------------------------- /src/ios/loggable.ts: -------------------------------------------------------------------------------- 1 | import { DefaultLogger, Logger } from './logger'; 2 | 3 | export interface Loggable { 4 | logger: Logger | undefined; 5 | } 6 | 7 | export class LoggableExtension { 8 | 9 | /** 10 | Turn on Auth0.swift debug logging of HTTP requests and OAuth2 flow (iOS only) with a custom logger. 11 | 12 | - parameter logger: logger used to print log statements 13 | - note: By default all logging is **disabled** 14 | - important: Logging should be turned on/off **before** making request to Auth0 for the flag to take effect. 15 | */ 16 | public static using(loggable: Loggable, logger: Logger): Loggable { 17 | loggable.logger = logger; 18 | return loggable; 19 | } 20 | 21 | /** 22 | Turn on/off Auth0.swift debug logging of HTTP requests and OAuth2 flow (iOS only). 23 | 24 | - parameter enabled: optional flag to turn on/off logging 25 | - note: By default all logging is **disabled** 26 | - important: Logging should be turned on/off **before** making request to Auth0 for the flag to take effect. 27 | */ 28 | public static logging(loggable: Loggable, enabled: boolean): Loggable { 29 | if (enabled) { 30 | loggable.logger = new DefaultLogger(); 31 | } else { 32 | loggable.logger = undefined; 33 | } 34 | return loggable; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 18 | 19 | ## What is the current behavior? 20 | 21 | 22 | ## What is the new behavior? 23 | 24 | 25 | Fixes/Implements/Closes #[Issue Number]. 26 | 27 | 28 | 29 | 38 | 39 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Make sure to check the demo app(s) for sample usage 2 | 3 | ### Make sure to check the existing issues in this repository 4 | 5 | ### If the demo apps cannot help and there is no issue for your problem, tell us about it 6 | Please, ensure your title is less than 63 characters long and starts with a capital 7 | letter. 8 | 9 | ### Which platform(s) does your issue occur on? 10 | - iOS/Android/Both 11 | - iOS/Android versions 12 | - emulator or device. What type of device? 13 | 14 | ### Please, provide the following version numbers that your issue occurs with: 15 | 16 | - CLI: (run `tns --version` to fetch it) 17 | - Cross-platform modules: (check the 'version' attribute in the 18 | `node_modules/tns-core-modules/package.json` file in your project) 19 | - Runtime(s): (look for the `"tns-android"` and `"tns-ios"` properties in the `package.json` file of your project) 20 | - Plugin(s): (look for the version numbers in the `package.json` file of your 21 | project and paste your dependencies and devDependencies here) 22 | 23 | ### Please, tell us how to recreate the issue in as much detail as possible. 24 | Describe the steps to reproduce it. 25 | 26 | ### Is there any code involved? 27 | - provide a code example to recreate the problem 28 | - (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible. 29 | -------------------------------------------------------------------------------- /src/android/request/internal/authenticationErrorBuilder.ts: -------------------------------------------------------------------------------- 1 | import { ErrorBuilder } from '../errorBuilder'; 2 | import { AuthenticationException } from '../../authentication/authenticationException'; 3 | import { Auth0Exception } from '../../auth0Exception'; 4 | 5 | export class AuthenticationErrorBuilder implements ErrorBuilder { 6 | 7 | public from(message: string): AuthenticationException; 8 | public from(message: string, exception: Auth0Exception): AuthenticationException; 9 | public from(values: { [key: string]: any }): AuthenticationException; 10 | public from(payload: string, statusCode: number): AuthenticationException; 11 | public from(): AuthenticationException { 12 | if (arguments.length === 1) { 13 | if (typeof arguments[0] === 'string') { 14 | return new AuthenticationException({ description: arguments[0] }, 0); 15 | } else { 16 | return new AuthenticationException(arguments[0], 0); 17 | } 18 | } else { 19 | if (typeof arguments[1] === 'number') { 20 | return new AuthenticationException(arguments[0], arguments[1]); 21 | } else { 22 | return new AuthenticationException({ 23 | description: `${arguments[0]} - ${arguments[1].toString()}` 24 | }, 0); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/android/authentication/request/tokenRequest.ts: -------------------------------------------------------------------------------- 1 | import { AuthenticationException } from '../authenticationException'; 2 | import { Request } from '../../request/request'; 3 | import { ParameterizableRequest } from '../../request/parameterizableRequest'; 4 | import { BaseCallback } from '../../callback/baseCallback'; 5 | import { Credentials } from '../../../common/credentials'; 6 | 7 | /** 8 | * Auth Request to obtain tokens using OAuth2 {@literal /oauth/token} method 9 | */ 10 | export class TokenRequest implements Request { 11 | 12 | private static readonly OAUTH_CODE_VERIFIER_KEY: string = "code_verifier"; 13 | 14 | private readonly request: ParameterizableRequest; 15 | 16 | constructor(request: ParameterizableRequest) { 17 | this.request = request; 18 | } 19 | 20 | /** 21 | * Adds the code verifier to the request (Public Clients) 22 | * 23 | * @param codeVerifier the code verifier used to generate the challenge sent to /authorize. 24 | * @return itself 25 | */ 26 | public setCodeVerifier(codeVerifier: string): TokenRequest { 27 | this.request.addParameter(TokenRequest.OAUTH_CODE_VERIFIER_KEY, codeVerifier); 28 | return this; 29 | } 30 | 31 | public start(callback: BaseCallback): void { 32 | this.request.start(callback); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demo-vue/app/components/App.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 42 | 43 | 48 | -------------------------------------------------------------------------------- /src/ios/silentSafariViewController.ts: -------------------------------------------------------------------------------- 1 | import { Device } from '@nativescript/core'; 2 | 3 | @NativeClass() 4 | class SilentSafariViewController extends SFSafariViewController implements SFSafariViewControllerDelegate { 5 | public onResult: (result: boolean) => void = () => {}; 6 | 7 | public static alloc(): SilentSafariViewController { 8 | return super.alloc(); 9 | } 10 | 11 | public initWithURLCallback(URL: NSURL, callback: (result: boolean) => void) { 12 | if (Number(Device.osVersion.split('.')[0]) >= 11.0) { 13 | super.initWithURLConfiguration(URL, new SFSafariViewControllerConfiguration()); 14 | } else { 15 | super.initWithURLEntersReaderIfAvailable(URL, false); 16 | } 17 | 18 | this.onResult = callback; 19 | this.delegate = this; 20 | this.view.alpha = 0.05; // Apple does not allow invisible SafariViews, this is the threshold. 21 | this.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; 22 | 23 | return this; 24 | } 25 | 26 | public safariViewController(controller: SFSafariViewController, didLoadSuccessfully: boolean) { 27 | controller.dismissViewControllerAnimatedCompletion(false, () => { 28 | this.onResult(didLoadSuccessfully); 29 | }); 30 | } 31 | 32 | public static ObjCProtocols = [ SFSafariViewControllerDelegate ]; 33 | } 34 | 35 | export { 36 | SilentSafariViewController 37 | }; 38 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from './common/credentials'; 2 | import { UserInfo } from './common/userInfo'; 3 | export { 4 | Credentials, 5 | UserInfo 6 | }; 7 | export { ResponseType } from './auth0-common'; 8 | 9 | 10 | /** 11 | * iOS Only 12 | * Used with AppDelegate applicationOpenURLOptions 13 | * @param url NSURL 14 | * @param options NSDictionary 15 | */ 16 | export declare function resumeAuth(url: any, options: any): boolean; 17 | 18 | export interface WebAuthOptions { 19 | audience?: string; 20 | connection?: string; 21 | /** 22 | * Not supported by iOS yet. 23 | */ 24 | nonce?: string; 25 | /** 26 | * Not supported by iOS yet. 27 | */ 28 | responseType?: ResponseType; 29 | /** 30 | * Not supported by iOS yet. 31 | */ 32 | scheme?: string; 33 | scope?: string; 34 | state?: string; 35 | parameters?: { [param: string]: string; }; 36 | } 37 | 38 | export class WebAuthException extends Error { 39 | constructor(message); 40 | } 41 | 42 | export class Auth0 { 43 | constructor(clientId: string, domain: string); 44 | 45 | public webAuthentication(options: WebAuthOptions): Promise; 46 | public renewCredentials(refreshToken: string): Promise; 47 | public revokeRefreshToken(refreshToken: string): Promise; 48 | public getUserInfo(accessToken: string): Promise; 49 | public logoutUser(federated: boolean): Promise; 50 | } 51 | -------------------------------------------------------------------------------- /src/common/databaseUser.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Auth0 user created in a Database connection. 4 | * 5 | * @see AuthenticationAPIClient#signUp(String, String, String) 6 | */ 7 | export class DatabaseUser { 8 | 9 | public readonly email: string | undefined; 10 | public readonly username: string | undefined; 11 | public readonly emailVerified: boolean | undefined; 12 | 13 | constructor( 14 | email: string | undefined = undefined, 15 | username: string | undefined = undefined, 16 | emailVerified: boolean | undefined = undefined 17 | ) { 18 | this.email = email; 19 | this.username = username; 20 | this.emailVerified = emailVerified; 21 | } 22 | 23 | public static initWithJson(json: { [key: string]: any }): DatabaseUser { 24 | const username = json["username"]; 25 | 26 | const email = json["email"]; 27 | let emailVerified: boolean | undefined; 28 | const emailVerifiedRaw = json["email_verified"]; 29 | if (emailVerifiedRaw != null) { 30 | emailVerified = (typeof emailVerifiedRaw === 'boolean') 31 | ? emailVerifiedRaw 32 | : emailVerifiedRaw === 'true'; 33 | } 34 | return new DatabaseUser(email, username, emailVerified); 35 | } 36 | 37 | public toJSON() { 38 | return { 39 | email: this.email, 40 | username: this.username, 41 | email_verified: this.emailVerified 42 | }; 43 | } 44 | } -------------------------------------------------------------------------------- /demo/app/auth0-setup.ts: -------------------------------------------------------------------------------- 1 | import { Application } from "@nativescript/core"; 2 | import { resumeAuth } from "nativescript-auth0"; 3 | 4 | export function setupAuth0() { 5 | if (global.isIOS) { 6 | @NativeClass() 7 | class CustomAppDelegate 8 | extends UIResponder 9 | implements UIApplicationDelegate { 10 | public static ObjCProtocols = [UIApplicationDelegate]; 11 | 12 | public applicationDidEnterBackground(application: UIApplication) { 13 | console.log("applicationDidEnterBackground"); 14 | } 15 | 16 | public applicationDidFinishLaunchingWithOptions( 17 | application: UIApplication, 18 | launchOptions: any 19 | ): boolean { 20 | console.log("applicationDidFinishLaunchingWithOptions"); 21 | return true; 22 | } 23 | 24 | applicationOpenURLOptions?( 25 | application: UIApplication, 26 | url: NSURL, 27 | options: NSDictionary 28 | ) { 29 | console.log("applicationOpenURLOptions"); 30 | return resumeAuth(url, options); 31 | } 32 | 33 | applicationContinueUserActivityRestorationHandler?( 34 | application: UIApplication, 35 | userActivity: NSUserActivity, 36 | restorationHandler: (p1: NSArray) => void 37 | ) { 38 | console.log("applicationContinueUserActivityRestorationHandler"); 39 | return true; 40 | } 41 | } 42 | 43 | Application.ios.delegate = CustomAppDelegate; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demo-vue/app/auth0-setup.ts: -------------------------------------------------------------------------------- 1 | import { Application } from "@nativescript/core"; 2 | import { resumeAuth } from "nativescript-auth0"; 3 | 4 | export function setupAuth0() { 5 | if (global.isIOS) { 6 | @NativeClass() 7 | class CustomAppDelegate 8 | extends UIResponder 9 | implements UIApplicationDelegate { 10 | public static ObjCProtocols = [UIApplicationDelegate]; 11 | 12 | public applicationDidEnterBackground(application: UIApplication) { 13 | console.log("applicationDidEnterBackground"); 14 | } 15 | 16 | public applicationDidFinishLaunchingWithOptions( 17 | application: UIApplication, 18 | launchOptions: any 19 | ): boolean { 20 | console.log("applicationDidFinishLaunchingWithOptions"); 21 | return true; 22 | } 23 | 24 | applicationOpenURLOptions?( 25 | application: UIApplication, 26 | url: NSURL, 27 | options: NSDictionary 28 | ) { 29 | console.log("applicationOpenURLOptions"); 30 | return resumeAuth(url, options); 31 | } 32 | 33 | applicationContinueUserActivityRestorationHandler?( 34 | application: UIApplication, 35 | userActivity: NSUserActivity, 36 | restorationHandler: (p1: NSArray) => void 37 | ) { 38 | console.log("applicationContinueUserActivityRestorationHandler"); 39 | return true; 40 | } 41 | } 42 | 43 | Application.ios.delegate = CustomAppDelegate; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /demo-angular/src/app/auth0/auth0-setup.ts: -------------------------------------------------------------------------------- 1 | import { Application } from "@nativescript/core"; 2 | import { resumeAuth } from "nativescript-auth0"; 3 | 4 | export function setupAuth0() { 5 | if (global.isIOS) { 6 | @NativeClass() 7 | class CustomAppDelegate 8 | extends UIResponder 9 | implements UIApplicationDelegate { 10 | public static ObjCProtocols = [UIApplicationDelegate]; 11 | 12 | public applicationDidEnterBackground(application: UIApplication) { 13 | console.log("applicationDidEnterBackground"); 14 | } 15 | 16 | public applicationDidFinishLaunchingWithOptions( 17 | application: UIApplication, 18 | launchOptions: any 19 | ): boolean { 20 | console.log("applicationDidFinishLaunchingWithOptions"); 21 | return true; 22 | } 23 | 24 | applicationOpenURLOptions?( 25 | application: UIApplication, 26 | url: NSURL, 27 | options: NSDictionary 28 | ) { 29 | console.log("applicationOpenURLOptions"); 30 | return resumeAuth(url, options); 31 | } 32 | 33 | applicationContinueUserActivityRestorationHandler?( 34 | application: UIApplication, 35 | userActivity: NSUserActivity, 36 | restorationHandler: (p1: NSArray) => void 37 | ) { 38 | console.log("applicationContinueUserActivityRestorationHandler"); 39 | return true; 40 | } 41 | } 42 | 43 | Application.ios.delegate = CustomAppDelegate; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/ios/auth0Error.ts: -------------------------------------------------------------------------------- 1 | export const unknownError = 'a0.sdk.internal_error.unknown'; 2 | export const nonJSONError = 'a0.sdk.internal_error.plain'; 3 | export const emptyBodyError = 'a0.sdk.internal_error.empty'; 4 | 5 | /** 6 | Generic representation of Auth0 API errors 7 | - note: It's recommended to use either `AuthenticationError` or `ManagementError` for better error handling 8 | */ 9 | export class Auth0Error extends Error { 10 | public readonly info: { [key: string]: any }; 11 | 12 | constructor(infoOrString: { [key: string]: any } | string | undefined = undefined, statusCode: number = 0) { 13 | if (typeof infoOrString === 'object') { 14 | const values = infoOrString; 15 | values['statusCode'] = statusCode; 16 | super(values['description'] || `Failed with unknown error ${JSON.stringify(values)}`); 17 | this.info = values; 18 | } else { 19 | const code = infoOrString != null ? nonJSONError : emptyBodyError; 20 | const description = infoOrString || 'Empty response body'; 21 | super(description); 22 | this.info = { 23 | 'code': code, 24 | 'description': description, 25 | 'statusCode': statusCode 26 | }; 27 | } 28 | Object.setPrototypeOf(this, new.target.prototype); 29 | } 30 | 31 | /// The code of the error as a String 32 | public get code(): string { 33 | return this.info["code"] || unknownError; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [ 5 | true, 6 | "check-space" 7 | ], 8 | "indent": [ 9 | true, 10 | "spaces" 11 | ], 12 | "no-duplicate-variable": true, 13 | "no-eval": true, 14 | "no-internal-module": true, 15 | "no-trailing-whitespace": true, 16 | "no-var-keyword": true, 17 | "one-line": [ 18 | true, 19 | "check-open-brace", 20 | "check-whitespace" 21 | ], 22 | "quotemark": [ 23 | false, 24 | "double" 25 | ], 26 | "semicolon": [ 27 | true, 28 | "always" 29 | ], 30 | "triple-equals": [ 31 | true, 32 | "allow-null-check" 33 | ], 34 | "typedef-whitespace": [ 35 | true, 36 | { 37 | "call-signature": "nospace", 38 | "index-signature": "nospace", 39 | "parameter": "nospace", 40 | "property-declaration": "nospace", 41 | "variable-declaration": "nospace" 42 | } 43 | ], 44 | "variable-name": [ 45 | true, 46 | "ban-keywords" 47 | ], 48 | "whitespace": [ 49 | true, 50 | "check-branch", 51 | "check-decl", 52 | "check-operator", 53 | "check-separator", 54 | "check-type" 55 | ] 56 | } 57 | } -------------------------------------------------------------------------------- /src/platforms/android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/ios/safariSession.ts: -------------------------------------------------------------------------------- 1 | import { OAuth2Grant } from './oauth2Grant'; 2 | import { AuthSession } from './authSession'; 3 | import { Result } from './result'; 4 | import { Credentials } from '../common/credentials'; 5 | import { Logger } from './logger'; 6 | import { TransactionStore } from './transactionStore'; 7 | 8 | @NativeClass() 9 | export class SafariSessionDelegate extends NSObject { 10 | 11 | public static ObjCProtocols = [SFSafariViewControllerDelegate]; 12 | private _owner: WeakRef; 13 | 14 | public static initWithOwner(owner: WeakRef): SafariSessionDelegate { 15 | const delegate = SafariSessionDelegate.new() as SafariSessionDelegate; 16 | delegate._owner = owner; 17 | 18 | return delegate; 19 | } 20 | 21 | public safariViewControllerDidFinish(controller: SFSafariViewController) { 22 | TransactionStore.shared.cancel(this._owner.get()); 23 | } 24 | } 25 | 26 | export class SafariSession extends AuthSession { 27 | 28 | controller: WeakRef; 29 | private _delegate: SafariSessionDelegate; 30 | 31 | constructor( 32 | controller: SFSafariViewController, 33 | redirectURL: NSURL, 34 | state: string | undefined = undefined, 35 | handler: OAuth2Grant, 36 | finish: (result: Result) => void, 37 | logger: Logger | undefined 38 | ) { 39 | super(redirectURL, state, handler, finish, logger); 40 | this.controller = new WeakRef(controller); 41 | this._delegate = SafariSessionDelegate.initWithOwner(new WeakRef(this)); 42 | controller.delegate = this._delegate; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/ios/webAuthError.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | List of possible web-based authentication errors 3 | 4 | - NoBundleIdentifierFound: Cannot get the App's Bundle Identifier to use for redirect_uri. 5 | - CannotDismissWebAuthController: When trying to dismiss WebAuth controller, no presenter controller could be found. 6 | - UserCancelled: User cancelled the web-based authentication, e.g. tapped the "Done" button in SFSafariViewController 7 | - PKCENotAllowed: PKCE for the supplied Auth0 ClientId was not allowed. You need to set the `Token Endpoint Authentication Method` to `None` in your Auth0 Dashboard 8 | - noNonceProvided: A nonce value must be provided to use the response option of id_token 9 | - invalidIdTokenNonce: Failed to match token nonce with request nonce 10 | - missingAccessToken: access_token missing in response 11 | */ 12 | declare class WebAuthError extends Error { 13 | static noBundleIdentifierFound: WebAuthError; 14 | static cannotDismissWebAuthController: WebAuthError; 15 | static userCancelled: WebAuthError; 16 | static pkceNotAllowed(message: string): WebAuthError; 17 | static noNonceProvided: WebAuthError; 18 | static missingResponseParam: WebAuthError; 19 | static invalidIdTokenNonce: WebAuthError; 20 | static missingAccessToken: WebAuthError; 21 | static readonly genericFoundationCode = 1; 22 | static readonly cancelledFoundationCode = 0; 23 | static readonly infoKey = "com.auth0.webauth.error.info"; 24 | static readonly errorDomain: String; 25 | constructor(message: string); 26 | get errorCode(): number; 27 | } 28 | export { WebAuthError }; 29 | -------------------------------------------------------------------------------- /src/ios/telemetry.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpRequestOptions } from '@nativescript/core/http'; 2 | export declare class Telemetry { 3 | static readonly NameKey: string; 4 | static readonly VersionKey: string; 5 | static readonly WrappedVersion: string; 6 | static readonly NoVersion: string; 7 | static readonly LibraryName: string; 8 | enabled: boolean; 9 | info?: string; 10 | get value(): string | undefined; 11 | constructor(); 12 | wrapped(name: string, version: string): void; 13 | addTelemetryHeader(request: HttpRequestOptions): void; 14 | queryItemsWithTelemetry(queryItems: NSURLQueryItem[]): NSURLQueryItem[]; 15 | static versionInformation(): { 16 | [key: string]: string; 17 | }; 18 | static generateValue(info?: { 19 | [key: string]: string; 20 | }): string | undefined; 21 | } 22 | export interface Trackable { 23 | telemetry: Telemetry; 24 | } 25 | export declare class TrackableExtension { 26 | /** 27 | Avoid Auth0.swift sending its version on every request to Auth0 API. 28 | By default we collect our libraries and SDKs versions to help us during support and evaluate usage. 29 | 30 | - parameter enabled: if Auth0.swift should send it's version on every request. 31 | */ 32 | static tracking(trackable: Trackable, enabled: boolean): void; 33 | /** 34 | Send the library/framework, that has Auth0.swift as dependency, when sending telemetry information 35 | 36 | - parameter name: name of library or framework that uses Auth0.swift 37 | - parameter version: version of library or framework 38 | */ 39 | static using(trackable: Trackable, name: string, version: string): void; 40 | } 41 | -------------------------------------------------------------------------------- /src/ios/authenticationError.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Error } from './auth0Error'; 2 | /** 3 | * Represents an error during a request to Auth0 Authentication API 4 | */ 5 | export declare class AuthenticationError extends Auth0Error { 6 | /** 7 | Creates a Auth0 Auth API error when the request's response is not JSON 8 | 9 | - parameter string: string representation of the response (or null) 10 | - parameter statusCode: response status code 11 | 12 | - returns: a newly created AuthenticationError 13 | */ 14 | constructor(_string?: string | undefined, statusCode?: number); 15 | /** 16 | Creates a Auth0 Auth API error from a JSON response 17 | 18 | - parameter info: JSON response from Auth0 19 | - parameter statusCode: Http Status Code of the Response 20 | 21 | - returns: a newly created AuthenticationError 22 | */ 23 | constructor(info: { 24 | [key: string]: any; 25 | }, statusCode: number); 26 | get isMultifactorRequired(): boolean; 27 | get isMultifactorEnrollRequired(): boolean; 28 | get isMultifactorCodeInvalid(): boolean; 29 | get isMultifactorTokenInvalid(): boolean; 30 | get isPasswordNotStrongEnough(): boolean; 31 | get isPasswordAlreadyUsed(): boolean; 32 | get isRuleError(): boolean; 33 | get isInvalidCredentials(): boolean; 34 | get isAccessDenied(): boolean; 35 | get isTooManyAttempts(): boolean; 36 | /** 37 | Returns a value from error `info` dictionary 38 | 39 | - parameter key: key of the value to return 40 | 41 | - returns: the value of key or null if cannot be found or is of the wrong type. 42 | */ 43 | value(key: string): T | undefined; 44 | } 45 | -------------------------------------------------------------------------------- /src/platforms/ios/src/A0ChallengeGenerator.h: -------------------------------------------------------------------------------- 1 | // A0ChallengeGenerator.h 2 | // 3 | // Copyright (c) 2016 Auth0 (http://auth0.com) 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | // THE SOFTWARE. 22 | 23 | #import 24 | 25 | NS_ASSUME_NONNULL_BEGIN 26 | @interface A0SHA256ChallengeGenerator : NSObject 27 | @property (readonly, strong, nonatomic) NSString *verifier; 28 | @property (readonly, strong, nonatomic) NSString *challenge; 29 | @property (readonly, strong, nonatomic) NSString *method; 30 | 31 | - (instancetype)init; 32 | - (instancetype)initWithVerifier:(NSData *)verifier; 33 | 34 | @end 35 | NS_ASSUME_NONNULL_END -------------------------------------------------------------------------------- /src/android/authentication/request/profileRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { AuthenticationException } from '../authenticationException'; 2 | import { Request } from '../../request/request'; 3 | import { Authentication } from '../../result/authentication'; 4 | import { AuthenticationRequest } from '../../request/authenticationRequest'; 5 | import { ParameterizableRequest } from '../../request/parameterizableRequest'; 6 | import { UserInfo } from '../../../common/userInfo'; 7 | import { BaseCallback } from '../../callback/baseCallback'; 8 | /** 9 | * Request to fetch a profile after a successful authentication with Auth0 Authentication API 10 | */ 11 | export declare class ProfileRequest implements Request { 12 | private static readonly HEADER_AUTHORIZATION; 13 | private readonly credentialsRequest; 14 | private readonly userInfoRequest; 15 | constructor(credentialsRequest: AuthenticationRequest, userInfoRequest: ParameterizableRequest); 16 | /** 17 | * Adds additional parameters for the login request 18 | * 19 | * @param parameters as a non-null dictionary 20 | * @return itself 21 | */ 22 | addParameters(parameters: { 23 | [key: string]: any; 24 | }): ProfileRequest; 25 | /** 26 | * Set the scope used to authenticate the user 27 | * 28 | * @param scope value 29 | * @return itself 30 | */ 31 | setScope(scope: string): ProfileRequest; 32 | /** 33 | * Starts the log in request and then fetches the user's profile 34 | * 35 | * @param callback called on either success or failure 36 | */ 37 | start(callback: BaseCallback): void; 38 | } 39 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | ## Version Notes 3 | 4 | ### 3.0.2 5 | 6 | fix(android): android devices without customtabs support not falling back to default browser 7 | 8 | ### 3.0.1 9 | 10 | fix(common): UserInfo incorrect JSON serialization 11 | 12 | ### 3.0.0 13 | 14 | feat: Update to NativeScript 6.0 with AndroidX 15 | 16 | BREAKING CHANGE: NativeScript 6.0 required due to AndroidX support 17 | 18 | ### 2.1.2 19 | 20 | fix(android): Browser not opening on Xiaomi device 21 | fix(style): Fixed tslint errors 22 | 23 | ### 2.1.1 24 | 25 | Fix crash related to null foregroundActivity 26 | Fix errors on android not building properly 27 | Fix user cancel on android not raising error 28 | 29 | ### 2.1.0 30 | 31 | Remove use of a large pod and replace with a small Objective-C file 32 | Update readme 33 | 34 | ### 2.0.4 35 | 36 | Fix bugged iOS version comparsion causing SafariAuthenticationSession to not be used. 37 | 38 | ### 2.0.3 39 | 40 | Fix crash occuring on devices running older than Android 6.0 41 | 42 | ### 2.0.2 43 | 44 | Fix Web Authentication flow on Android returning Credentials object with idToken and accessToken mixed around 45 | Fix JSON serialization for Credentials, DatabaseUser, and UserInfo objects 46 | 47 | ### 2.0.1 48 | 49 | Fix publish 50 | 51 | ### 2.0.0 52 | 53 | Rewrite to using Auth0 Universal Login 54 | 55 | ### 1.2.7 56 | 57 | Merged in some PRs, NG2 demo, audience property 58 | 59 | ### 1.2.6 60 | 61 | Update to android lock v2 62 | 63 | ### 1.2.3 64 | 65 | Bug fixes 66 | 67 | ### 1.2.0 68 | 69 | Updated API to Auth0 v2 Swift on iOS 70 | 71 | ### 1.0.0 72 | 73 | Total rewrite, hey, but it works! Per semvar incrimenting major version as there's breaking changes. However the bonus of this is you no longer need app.js initaliation code. 74 | -------------------------------------------------------------------------------- /src/android/util/telemetry.ts: -------------------------------------------------------------------------------- 1 | import Base64 = android.util.Base64; 2 | 3 | export class Telemetry { 4 | public static readonly HEADER_NAME: string = "Auth0-Client"; 5 | 6 | private static readonly NAME_KEY: string = "name"; 7 | private static readonly VERSION_KEY: string = "version"; 8 | private static readonly LIB_VERSION_KEY: string = "lib_version"; 9 | 10 | private readonly name: string; 11 | private readonly version: string; 12 | private readonly libraryVersion: string | undefined; 13 | 14 | constructor(name: string, version: string, libraryVersion: string = undefined) { 15 | this.name = name; 16 | this.version = version; 17 | this.libraryVersion = libraryVersion; 18 | } 19 | 20 | public getName(): string { 21 | return this.name; 22 | } 23 | 24 | public getVersion(): string { 25 | return this.version; 26 | } 27 | 28 | public getLibraryVersion(): string | undefined { 29 | return this.libraryVersion; 30 | } 31 | 32 | public getValue(): string { 33 | const values: { [key: string]: any } = {}; 34 | if (this.name != null) { 35 | values[Telemetry.NAME_KEY] = this.name; 36 | } 37 | if (this.version != null) { 38 | values[Telemetry.VERSION_KEY] = this.version; 39 | } 40 | if (this.libraryVersion != null) { 41 | values[Telemetry.LIB_VERSION_KEY] = this.libraryVersion; 42 | } 43 | if (Object.keys(values).length === 0) { 44 | return null; 45 | } 46 | const javaString = new java.lang.String(JSON.stringify(values)); 47 | return Base64.encodeToString(javaString.getBytes('UTF-8'), Base64.URL_SAFE | Base64.NO_WRAP | Base64.NO_PADDING); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/android/authentication/request/databaseConnectionRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { Auth0Exception } from '../../auth0Exception'; 2 | import { ParameterizableRequest } from '../../request/parameterizableRequest'; 3 | import { BaseCallback } from '../../callback/baseCallback'; 4 | /** 5 | * Request to perform a non-authentication related action 6 | * like creating a user or requesting a change password 7 | */ 8 | export declare class DatabaseConnectionRequest { 9 | private readonly request; 10 | constructor(request: ParameterizableRequest); 11 | /** 12 | * Add the given parameters to the request 13 | * @param parameters to be sent with the request 14 | * @return itself 15 | */ 16 | addParameters(parameters: { 17 | [key: string]: any; 18 | }): DatabaseConnectionRequest; 19 | /** 20 | * Add a parameter by name to the request 21 | * @param name of the parameter 22 | * @param value of the parameter 23 | * @return itself 24 | */ 25 | addParameter(name: string, value: any): DatabaseConnectionRequest; 26 | /** 27 | * Add a header for request: the, e.g. "Authorization" 28 | * @param name of the header 29 | * @param value of the header 30 | * @return itself 31 | */ 32 | addHeader(name: string, value: string): DatabaseConnectionRequest; 33 | /** 34 | * Set the Auth0 Database Connection used for this request using its name. 35 | * @param connection name 36 | * @return itself 37 | */ 38 | setConnection(connection: string): DatabaseConnectionRequest; 39 | /** 40 | * Executes the request async and returns its results via callback 41 | * @param callback called on success or failure of the request 42 | */ 43 | start(callback: BaseCallback): void; 44 | } 45 | -------------------------------------------------------------------------------- /src/android/provider/callbackHelper.ts: -------------------------------------------------------------------------------- 1 | 2 | import Uri = android.net.Uri; 3 | import Log = android.util.Log; 4 | import URLUtil = android.webkit.URLUtil; 5 | 6 | export abstract class CallbackHelper { 7 | 8 | private static readonly TAG: string = 'CallbackHelper'; 9 | 10 | /** 11 | * Generates the callback Uri for the given domain. 12 | * 13 | * @return the callback Uri. 14 | */ 15 | public static getCallbackUri(scheme: string, packageName: string, domain: string): string { 16 | if (!URLUtil.isValidUrl(domain)) { 17 | Log.e(CallbackHelper.TAG, "The Domain is invalid and the Callback URI will not be set. You used: " + domain); 18 | return null; 19 | } 20 | 21 | const uri = Uri.parse(domain) 22 | .buildUpon() 23 | .scheme(scheme) 24 | .appendPath("android") 25 | .appendPath(packageName) 26 | .appendPath("callback") 27 | .build(); 28 | 29 | Log.v(CallbackHelper.TAG, "The Callback URI is: " + uri); 30 | return uri.toString(); 31 | } 32 | 33 | public static getValuesFromUri(uri: Uri): { [key: string]: string } { 34 | return CallbackHelper.asMap(uri.getQuery() != null ? uri.getQuery() : uri.getFragment()); 35 | } 36 | 37 | private static asMap(valueString: string | undefined): { [key: string]: string } { 38 | if (valueString == null) { 39 | return {}; 40 | } 41 | const entries = valueString.length > 0 ? valueString.split('&') : []; 42 | const values = {}; 43 | for (const entry of entries) { 44 | const value = entry.split('='); 45 | if (value.length === 2) { 46 | values[value[0]] = value[1]; 47 | } 48 | } 49 | return values; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/android/request/authenticationRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from '../../common/credentials'; 2 | import { AuthenticationException } from '../authentication/authenticationException'; 3 | import { Request } from './request'; 4 | /** 5 | * Request to authenticate a user with Auth0 Authentication API 6 | */ 7 | export interface AuthenticationRequest extends Request { 8 | /** 9 | * Sets the 'grant_type' parameter 10 | * 11 | * @param grantType grant type 12 | * @return itself 13 | */ 14 | setGrantType(grantType: string): AuthenticationRequest; 15 | /** 16 | * Sets the 'realm' parameter. A realm identifies the host against which the authentication will be made, and usually helps to know which username and password to use. 17 | * 18 | * @param realm name of the realm to use. 19 | * @return itself 20 | */ 21 | setRealm(realm: string): AuthenticationRequest; 22 | /** 23 | * Sets the 'scope' parameter. 24 | * 25 | * @param scope a scope value 26 | * @return itself 27 | */ 28 | setScope(scope: string): AuthenticationRequest; 29 | /** 30 | * Sets the 'audience' parameter. 31 | * 32 | * @param audience an audience value 33 | * @return itself 34 | */ 35 | setAudience(audience: string): AuthenticationRequest; 36 | /** 37 | * Sets the 'access_token' parameter 38 | * 39 | * @param accessToken a access token 40 | * @return itself 41 | */ 42 | setAccessToken(accessToken: string): AuthenticationRequest; 43 | /** 44 | * All all entries of the map as parameters of this request 45 | * 46 | * @param parameters to be added to the request 47 | * @return itself 48 | */ 49 | addAuthenticationParameters(parameters: { 50 | [key: string]: any; 51 | }): AuthenticationRequest; 52 | } 53 | -------------------------------------------------------------------------------- /src/ios/safariAuthenticationSession.ts: -------------------------------------------------------------------------------- 1 | import { AuthSession } from './authSession'; 2 | import { Credentials } from '../common/credentials'; 3 | import { Result } from './result'; 4 | import { Logger } from './logger'; 5 | import { OAuth2Grant } from './oauth2Grant'; 6 | import { TransactionStore } from './transactionStore'; 7 | import { WebAuthError } from './webAuthError'; 8 | 9 | export class SafariAuthenticationSession extends AuthSession { 10 | 11 | public authSession: SFAuthenticationSession | undefined; 12 | public readonly authorizeURL: NSURL; 13 | 14 | constructor(authorizeURL: NSURL, redirectURL: NSURL, state: string | undefined = null, handler: OAuth2Grant, finish: (result: Result) => void, logger: Logger | undefined) { 15 | super(redirectURL, state, handler, finish, logger); 16 | this.authorizeURL = authorizeURL; 17 | this.authSession = new SFAuthenticationSession({ 18 | URL: this.authorizeURL, 19 | callbackURLScheme: this.redirectURL.absoluteString, 20 | completionHandler: (url, error) => { 21 | if (error != null || url == null) { 22 | if (SFAuthenticationError.CanceledLogin === error.code) { 23 | this.finish({ 24 | failure: WebAuthError.userCancelled 25 | }); 26 | } else { 27 | this.finish({ 28 | failure: new WebAuthError(error.description) 29 | }); 30 | } 31 | return TransactionStore.shared.clear(); 32 | } 33 | const _ = TransactionStore.shared.resume(url, NSDictionary.dictionary()); 34 | } 35 | }); 36 | if (this.authSession != null) { 37 | this.authSession.start(); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/android/request/authenticationRequest.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from '../../common/credentials'; 2 | import { AuthenticationException } from '../authentication/authenticationException'; 3 | import { Request } from './request'; 4 | 5 | /** 6 | * Request to authenticate a user with Auth0 Authentication API 7 | */ 8 | export interface AuthenticationRequest extends Request { 9 | 10 | /** 11 | * Sets the 'grant_type' parameter 12 | * 13 | * @param grantType grant type 14 | * @return itself 15 | */ 16 | setGrantType(grantType: string): AuthenticationRequest; 17 | 18 | /** 19 | * Sets the 'realm' parameter. A realm identifies the host against which the authentication will be made, and usually helps to know which username and password to use. 20 | * 21 | * @param realm name of the realm to use. 22 | * @return itself 23 | */ 24 | setRealm(realm: string): AuthenticationRequest; 25 | 26 | /** 27 | * Sets the 'scope' parameter. 28 | * 29 | * @param scope a scope value 30 | * @return itself 31 | */ 32 | setScope(scope: string): AuthenticationRequest; 33 | 34 | /** 35 | * Sets the 'audience' parameter. 36 | * 37 | * @param audience an audience value 38 | * @return itself 39 | */ 40 | setAudience(audience: string): AuthenticationRequest; 41 | 42 | /** 43 | * Sets the 'access_token' parameter 44 | * 45 | * @param accessToken a access token 46 | * @return itself 47 | */ 48 | setAccessToken(accessToken: string): AuthenticationRequest; 49 | 50 | /** 51 | * All all entries of the map as parameters of this request 52 | * 53 | * @param parameters to be added to the request 54 | * @return itself 55 | */ 56 | addAuthenticationParameters(parameters: { [key: string]: any }): AuthenticationRequest; 57 | } 58 | -------------------------------------------------------------------------------- /src/ios/auth0Authentication.d.ts: -------------------------------------------------------------------------------- 1 | import { Authentication } from './authentication'; 2 | import { Telemetry } from './telemetry'; 3 | import { Logger } from './logger'; 4 | import { Credentials } from '../common/credentials'; 5 | import { AuthenticationError } from './authenticationError'; 6 | import { Request } from './request'; 7 | import { UserInfo } from '../common/userInfo'; 8 | import { WebAuth } from './webAuth'; 9 | import { DatabaseUser } from '../common/databaseUser'; 10 | export declare class Auth0Authentication extends Authentication { 11 | readonly clientId: string; 12 | readonly url: NSURL; 13 | telemetry: Telemetry; 14 | logger: Logger | undefined; 15 | constructor(clientId: string, url: NSURL, telemetry?: Telemetry); 16 | login(username: string, password: string, realm: string, audience: string | undefined, scope: string | undefined, parameters: { 17 | [key: string]: any; 18 | } | undefined): Request; 19 | loginWithOTP(otp: string, mfaToken: string): Request; 20 | createUser(email: string, username: string | undefined, password: string, connection: string, userMetadata?: { 21 | [key: string]: any; 22 | } | undefined): Request; 23 | resetPassword(email: string, connection: string): Request; 24 | userInfo(accessToken: string): Request; 25 | tokenExchangeWithParameters(parameters: { 26 | [key: string]: any; 27 | }): Request; 28 | tokenExchangeWithCode(code: string, codeVerifier: string, redirectURI: string): Request; 29 | renew(refreshToken: string): Request; 30 | revoke(refreshToken: string): Request; 31 | webAuth(connection: string): WebAuth; 32 | } 33 | -------------------------------------------------------------------------------- /src/ios/oauth2Grant.d.ts: -------------------------------------------------------------------------------- 1 | import { Credentials } from '../common/credentials'; 2 | import { ResponseType } from './responseType'; 3 | import { Result } from './result'; 4 | import { Authentication } from './authentication'; 5 | export interface OAuth2Grant { 6 | defaults: { 7 | [key: string]: string; 8 | }; 9 | credentials(values: { 10 | [key: string]: string; 11 | }, callback: (success: Result) => void): any; 12 | values(components: NSURLComponents): { 13 | [key: string]: string; 14 | }; 15 | } 16 | export declare class ImplicitGrant implements OAuth2Grant { 17 | readonly defaults: { 18 | [key: string]: string; 19 | }; 20 | readonly responseType: ResponseType[]; 21 | constructor(responseType?: ResponseType[], nonce?: string | undefined); 22 | credentials(values: { 23 | [key: string]: string; 24 | }, callback: (success: Result) => void): void; 25 | values(components: NSURLComponents): { 26 | [key: string]: string; 27 | }; 28 | } 29 | export declare class PKCE implements OAuth2Grant { 30 | readonly authentication: Authentication; 31 | readonly redirectURL: NSURL; 32 | readonly defaults: { 33 | [key: string]: string; 34 | }; 35 | readonly verifier: string; 36 | readonly responseType: ResponseType[]; 37 | static init(authentication: Authentication, redirectURL: NSURL, reponseType?: ResponseType[], nonce?: string | undefined, generator?: A0SHA256ChallengeGenerator): PKCE; 38 | constructor(authentication: Authentication, redirectURL: NSURL, verifier: string, challenge: string, method: string, responseType: ResponseType[], nonce?: string | undefined); 39 | credentials(values: { 40 | [key: string]: string; 41 | }, callback: (result: Result) => void): void; 42 | values(components: NSURLComponents): { 43 | [key: string]: string; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /demo-angular/App_Resources/Android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 20 | 21 | 22 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 42 | 43 | -------------------------------------------------------------------------------- /demo-vue/app/App_Resources/Android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 17 | 18 | 20 | 21 | 22 | 29 | 30 | 32 | 33 | 34 | 39 | 40 | 42 | 43 | -------------------------------------------------------------------------------- /src/ios/authTransaction.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Represents an on going Auth transaction with an Identity Provider (Auth0 or a third party). 3 | 4 | The Auth will be done outside of application control, Safari or third party application. 5 | The only way to communicate the results back is using a url with a registered custom scheme in your application so iOS can open it on success/failure. 6 | When that happens iOS will call a method in your `AppDelegate` and that is where you need to handle the result. 7 | 8 | Ideally Auth0.swift will handle the current transaction by itself wether is OAuth2 or Native so you only need to add the following in the AppDelegate 9 | 10 | ``` 11 | func application(app: UIApplication, openURL url: NSURL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { 12 | return Auth0.resumeAuth(url, options: options) 13 | } 14 | ``` 15 | 16 | - important: Only one AuthTransaction can be active at a given time for Auth0.swift, if you start a new one before finishing the current one it will be cancelled. 17 | */ 18 | export interface AuthTransaction { 19 | readonly state?: string; 20 | /** 21 | Resumes the transaction when the third party application notifies the application using an url with a custom scheme. 22 | This method should be called from the Application's `AppDelegate` or using `public func resumeAuth(_ url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool` method. 23 | 24 | - parameter url: the url send by the third party application that contains the result of the Auth 25 | - parameter options: options recieved in the openUrl method of the `AppDelegate` 26 | - returns: if the url was expected and properly formatted otherwise it will return false. 27 | */ 28 | resume(url: NSURL, options: NSDictionary): boolean; 29 | /** 30 | Terminates the transaction and reports back that it was cancelled. 31 | */ 32 | cancel(): any; 33 | } 34 | -------------------------------------------------------------------------------- /demo/App_Resources/Android/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 21 | 22 | 23 | 31 | 32 | 34 | 35 | 36 | 42 | 43 | 45 | 46 | -------------------------------------------------------------------------------- /src/ios/controllerModalPresenter.ts: -------------------------------------------------------------------------------- 1 | export class ControllerModalPresenter { 2 | 3 | public get rootViewController(): UIViewController | undefined { 4 | const keyWindow = UIApplication.sharedApplication.keyWindow; 5 | return (keyWindow != null) ? keyWindow.rootViewController : undefined; 6 | } 7 | 8 | public present(controller: UIViewController) { 9 | if (this.topViewController != null) { 10 | this.topViewController.presentViewControllerAnimatedCompletion(controller, true, null); 11 | } 12 | } 13 | 14 | public get topViewController(): UIViewController | undefined { 15 | const root = this.rootViewController; 16 | if (root == null) { 17 | return undefined; 18 | } 19 | return this.findTopViewController(root); 20 | } 21 | 22 | private findTopViewController(root: UIViewController): UIViewController | undefined { 23 | const presented = root.presentedViewController; 24 | if (presented != null) { 25 | return this.findTopViewController(presented); 26 | } 27 | if (root instanceof UISplitViewController) { 28 | const last = root.viewControllers.lastObject; 29 | if (last == null) { 30 | return root; 31 | } 32 | return this.findTopViewController(last); 33 | } else if (root instanceof UINavigationController) { 34 | const top = root.topViewController; 35 | if (top == null) { 36 | return root; 37 | } 38 | return this.findTopViewController(top); 39 | } else if (root instanceof UITabBarController) { 40 | const selected = root.selectedViewController; 41 | if (selected == null) { 42 | return root; 43 | } 44 | return this.findTopViewController(selected); 45 | } else { 46 | return root; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/android/request/internal/baseAuthenticationRequest.d.ts: -------------------------------------------------------------------------------- 1 | import Uri = android.net.Uri; 2 | import { SimpleRequest } from './simpleRequest'; 3 | import { Credentials } from '../../../common/credentials'; 4 | import { AuthenticationException } from '../../authentication/authenticationException'; 5 | import { AuthenticationRequest } from '../authenticationRequest'; 6 | import { JSONObjectPayload } from '../../../common/jsonObjectPayload'; 7 | export declare class BaseAuthenticationRequest extends SimpleRequest implements AuthenticationRequest { 8 | private static readonly TAG; 9 | constructor(url: Uri, httpMethod: string, clazz: JSONObjectPayload); 10 | /** 11 | * Sets the 'grant_type' parameter 12 | * 13 | * @param grantType grant type 14 | * @return itself 15 | */ 16 | setGrantType(grantType: String): AuthenticationRequest; 17 | /** 18 | * Sets the 'realm' parameter. A realm identifies the host against which the authentication will made: be, and usually helps to know which username and password to use. 19 | * 20 | * @param realm name of the realm 21 | * @return itself 22 | */ 23 | setRealm(realm: String): AuthenticationRequest; 24 | /** 25 | * Sets the 'scope' parameter. 26 | * 27 | * @param scope a scope value 28 | * @return itself 29 | */ 30 | setScope(scope: String): AuthenticationRequest; 31 | /** 32 | * Sets the 'audience' parameter. 33 | * 34 | * @param audience an audience value 35 | * @return itself 36 | */ 37 | setAudience(audience: String): AuthenticationRequest; 38 | /** 39 | * Sets the 'access_token' parameter 40 | * 41 | * @param accessToken a access token 42 | * @return itself 43 | */ 44 | setAccessToken(accessToken: String): AuthenticationRequest; 45 | addAuthenticationParameters(parameters: { 46 | [key: string]: any; 47 | }): AuthenticationRequest; 48 | } 49 | -------------------------------------------------------------------------------- /demo/App_Resources/iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiresFullScreen 28 | 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | CFBundleURLTypes 47 | 48 | 49 | CFBundleTypeRole 50 | None 51 | CFBundleURLName 52 | auth0 53 | CFBundleURLSchemes 54 | 55 | org.nativescript.auth0demo 56 | 57 | 58 | 59 | 60 | 61 | --------------------------------------------------------------------------------