Auth0 is a social login provider for NativeScript allowing you to choose between 50 different providers. Use the Auth0 portal to select and configure the providers you would like to make available in your NativeScript application. The Auth0 NativeScript plugin will dynamically load your chosen providers into your application.
The dynamically loading feature reduces the amount of dependencies you’ll have in your application. You also don’t have to worry about loading and managing Cocoapods or Android Jars specific to each implementation.
Auth0 is a freemium service. The free tier supports up to 7,000 active users. Auth0 paid service levels are very reasonable.
In addition to managing many login providers, Auth0 also has solutions for application analytics, logging, web tasks and more. Take a look at all of the Auth0 features and services.
Requires NativeScript version >=7.0.0
.
tns plugin add nativescript-auth0
Go to your Auth0.com backend and configure your CallbackUrls, DO NOT USE THE KEYS IN THE DEMOConfigure Callback URLs
Syntax should be:
<!-- iOS -->
{YOUR_BUNDLE_IDENTIFIER}://${YOUR_AUTH0_DOMAIN}/ios/{YOUR_BUNDLE_IDENTIFIER}/callback
<!-- Android -->
https://{YOUR_AUTH0_DOMAIN}/android/{YOUR_APP_PACKAGE_NAME}/callback
Add this to your Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>CFBundleURLName</key>
<string>auth0</string>
<key>CFBundleURLSchemes</key>
<array>
<string>{YOUR_APP_BUNDLE_IDENTIFIER}</string>
</array>
</dict>
</array>
Add this to your AndroidManifest.xml
<activity
android:name="org.nativescript.auth0.RedirectActivity"
tools:node="replace">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="YOUR_AUTH0_DOMAIN"
android:pathPrefix="/android/${applicationId}/callback"
android:scheme="https" />
</intent-filter>
</activity>
Create a custom webpack configuration and add 'nativescript-auth0/android/provider/redirectActivity'
to appComponents
.
See the demo's nativescript.config.js#L11 and webpack.custom.config.js for an example.
Import Auth0 in a shared helper or something
import { Auth0, Credentials, WebAuthException } from 'nativescript-auth0';
Create your Auth0 object
this.auth0 = new Auth0('<your clientid>', '<your domain>');
Start the web authentication flow, returns a promise
this.auth0.webAuthentication({
scope: 'openid offline_access'
}).then((result: Credentials) => {
console.log(result);
}).catch((error: Error | WebAuthException) => {
console.log(error);
});
Name | Description | Docs | Returns |
---|---|---|---|
webAuthentication(options) | Starts the web authentication flow to login a user | Link | Promise<Credentials> |
renewCredentials(refreshToken) | Renews credentials using refresh token | Link | Promise<Credentials> |
revokeRefreshToken(refreshToken) | Revokes refresh token | Link | Promise<void> |
getUserInfo(accessToken) | Returns the current user details, might want to cache the results | Link | Promise<UserInfo> |
解决centos6.5中WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platfor [大数据入门] 问题描述: [root@node1 cloud]# hadoop fsck / -files -blocks DEPRECATED: Use of this script to execute h
YARN加载本地库抛出Unable to load native-hadoop library解决办法 用官方的Hadoop 2.1.0-beta安装后,每次hadoop命令进去都会抛出这样一个Warning WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using bui
MySQL 8.0.4 RC: 使用 auth_socket 用户要小心! 最新的 MySQL 8.0.4 RC(候选版) 发布的消息的确令人兴奋 不幸的是对于 auth_socket 插件的用户来说, 危险正在等待中! 早在 2015 年 11 月, 就有报告使用 sha256_password 进行 auth_socket 身份验证失败这防止在 SHA256 认证之后用 auth_socket
NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive
NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native
NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t
Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a
NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na
NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat