Skip to content

Commit a637ae2

Browse files
committed
feat: branch.io added and updated auth0 api
1 parent 5392640 commit a637ae2

3 files changed

Lines changed: 180 additions & 3 deletions

File tree

content/plugins/auth0.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ Start the web authentication flow:
2727

2828
```typescript
2929
try {
30-
const credentials = await auth0Client.webAuth.start();
30+
const credentials = await auth0Client.webAuth.start({
31+
scope: 'openid profile email',
32+
audience: 'https://your-api.com'
33+
});
3134
console.log('Access Token:', credentials.accessToken);
3235
console.log('ID Token:', credentials.idToken);
3336
console.log('Expires In:', credentials.expiresIn);
@@ -36,6 +39,25 @@ try {
3639
}
3740
```
3841

42+
#### Advanced Options
43+
44+
You can customize the authentication flow with additional options:
45+
46+
```typescript
47+
const credentials = await auth0Client.webAuth.start({
48+
scope: 'openid profile email',
49+
audience: 'https://your-api.com',
50+
scheme: 'myapp',
51+
redirectUrl: 'myapp://callback',
52+
ephemeral: true, // iOS only: Use ephemeral browser session
53+
parameters: {
54+
// Additional platform-specific parameters
55+
login_hint: 'user@example.com',
56+
ui_locales: 'es'
57+
}
58+
});
59+
```
60+
3961
### Configuration
4062

4163
Get your credentials from the [Auth0 Dashboard](https://manage.auth0.com/):
@@ -75,9 +97,38 @@ Create a new Auth0 client instance.
7597
| `clientId` | string | Your Auth0 Client ID |
7698
| `domain` | string | Your Auth0 domain |
7799

78-
### `auth0Client.webAuth.start()`
100+
### `auth0Client.webAuth.start(options?)`
101+
102+
Start the web authentication flow. Returns a Promise with credentials.
103+
104+
#### Options
105+
106+
| Option | Type | Platform | Description |
107+
| --- | --- | --- | --- |
108+
| `scope` | string | Both | OAuth scopes to request (e.g., 'openid profile email') |
109+
| `audience` | string | Both | API identifier for which to request access |
110+
| `scheme` | string | Both | Custom URL scheme for callback |
111+
| `redirectUrl` | string | Both | Custom redirect URL |
112+
| `ephemeral` | boolean | iOS | Use ephemeral browser session (doesn't persist cookies/data) |
113+
| `parameters` | Record<string, string> | Both | Additional authentication parameters |
114+
115+
#### Additional Parameters
116+
117+
The `parameters` option allows you to pass additional authentication parameters:
118+
119+
```typescript
120+
const credentials = await auth0Client.webAuth.start({
121+
parameters: {
122+
login_hint: 'user@example.com', // Pre-fill login email
123+
ui_locales: 'es', // Set UI language
124+
prompt: 'login', // Force login prompt
125+
max_age: '3600', // Maximum authentication age
126+
connection: 'google-oauth2' // Specify connection
127+
}
128+
});
129+
```
79130

80-
Start the web authentication flow. Returns a Promise with credentials:
131+
#### Credentials Response
81132

82133
```typescript
83134
interface Credentials {

content/plugins/branch.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Branch.io
2+
3+
Deep linking, mobile attribution, and analytics with Branch.io for NativeScript apps.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @nstudio/nativescript-branch
9+
```
10+
11+
## Usage
12+
13+
Import `BranchIO` from your app's main entry point and call the `initSession` method before the app launches:
14+
15+
```typescript
16+
import { BranchIO } from '@nstudio/nativescript-branch';
17+
18+
BranchIO.initSession();
19+
```
20+
21+
## Configuration
22+
23+
### Android Setup
24+
25+
Follow the [Android basic integration guide](https://help.branch.io/developers-hub/docs/android-basic-integration#4-configure-app) to configure your Android app.
26+
27+
Key steps:
28+
1. Add your Branch key to your Android manifest
29+
2. Configure deep link routing
30+
3. Add intent filters for your URL schemes
31+
32+
### iOS Setup
33+
34+
Follow the [iOS basic integration guide](https://help.branch.io/developers-hub/docs/ios-basic-integration) to configure your iOS app.
35+
36+
Key steps:
37+
1. Add your Branch key to Info.plist
38+
2. Configure Associated Domains
39+
3. Handle Universal Links
40+
41+
## Features
42+
43+
Branch.io provides powerful features for mobile apps:
44+
45+
- **Deep Linking** - Direct users to specific content within your app
46+
- **Attribution** - Track where your users come from
47+
- **Analytics** - Understand user behavior and campaign performance
48+
- **Smart Banners** - Display smart app banners on mobile web
49+
- **QR Codes** - Generate and track QR code campaigns
50+
51+
## API Reference
52+
53+
### `BranchIO.initSession()`
54+
55+
Initialize the Branch session. Call this method from your app's main entry point before the app launches.
56+
57+
```typescript
58+
import { BranchIO } from '@nstudio/nativescript-branch';
59+
60+
// Initialize Branch
61+
BranchIO.initSession();
62+
```
63+
64+
## Deep Link Handling
65+
66+
Branch allows you to handle deep links and route users to the appropriate content:
67+
68+
```typescript
69+
import { BranchIO } from '@nstudio/nativescript-branch';
70+
71+
// Listen for deep link data
72+
BranchIO.initSession((params) => {
73+
if (params['+clicked_branch_link']) {
74+
// User clicked a Branch link
75+
console.log('Deep link data:', params);
76+
77+
// Route user based on deep link parameters
78+
if (params.product_id) {
79+
// Navigate to product page
80+
}
81+
}
82+
});
83+
```
84+
85+
## Creating Branch Links
86+
87+
Create Branch links programmatically to share content:
88+
89+
```typescript
90+
const linkProperties = {
91+
feature: 'sharing',
92+
channel: 'email',
93+
campaign: 'product-launch',
94+
tags: ['tag1', 'tag2']
95+
};
96+
97+
const branchUniversalObject = {
98+
canonicalIdentifier: 'product/123',
99+
title: 'Product Name',
100+
contentDescription: 'Product description',
101+
contentImageUrl: 'https://example.com/image.jpg'
102+
};
103+
104+
// Generate a Branch link
105+
const link = await BranchIO.generateShortUrl(
106+
branchUniversalObject,
107+
linkProperties
108+
);
109+
console.log('Share link:', link);
110+
```
111+
112+
## Learn More
113+
114+
For complete documentation, visit the [Branch.io developers hub](https://help.branch.io/developers-hub/docs):
115+
116+
- [Android Integration](https://help.branch.io/developers-hub/docs/android-basic-integration)
117+
- [iOS Integration](https://help.branch.io/developers-hub/docs/ios-basic-integration)
118+
- [Branch Dashboard](https://dashboard.branch.io/)
119+
120+
## License
121+
122+
Apache License Version 2.0

content/plugins/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ A collection of high-quality NativeScript plugins from nStudio. Native performan
3232
- [Dynatrace](/plugins/dynatrace) - Application performance monitoring
3333
- [Appcues](/plugins/appcues) - In-app experiences and onboarding
3434

35+
## Deep Linking & Attribution
36+
37+
- [Branch.io](/plugins/branch) - Deep linking, mobile attribution, and analytics
38+
3539
## Customer Support
3640

3741
- [Freshchat](/plugins/freshchat) - In-app messaging and support

0 commit comments

Comments
 (0)