Skip to content

Commit b38b9b6

Browse files
authored
Merge pull request auth0#5027 from jeffreylees/lock-android-reorg
Lock-Android docs updates
2 parents dc52da1 + eaaa66d commit b38b9b6

29 files changed

+650
-635
lines changed

articles/libraries/lock-android/_includes/_next-steps.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* [Lock v1 Configuration](/libraries/lock-android/v1/configuration)
44
* [Lock v1 Use Your Own UI](/libraries/lock-android/v1/use-your-own-ui)
5-
* [Lock v1 Error Messages](/libraries/lock-android/v1/error-messages)
5+
* [Auth0 Error Messages](/libraries/error-messages)
66
* [Lock v1 Native Social Authentication](/libraries/lock-android/v1/native-social-authentication)
77
* [Lock v1 Magic Links](/libraries/lock-android/v1/passwordless-magic-link)
88
* [Lock v1 Refresh Tokens](/libraries/lock-android/v1/refresh-jwt-tokens)

articles/libraries/lock-android/v1/configuration.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
---
2+
toc: true
3+
title: Lock for Android v1 Configuration
24
description: Configuration options and methods for Lock for Android v1
35
---
4-
## Lock v1 Configuration
6+
# Lock Android: Configuration
57

68
<%= include('../_includes/_lock-version') %>
79

810
These are options that can be used to configure Lock for Android v1 to your project's needs.
911

10-
### Lock
12+
## Lock
1113

12-
#### Lock Constants
14+
### Lock Constants
1315

1416
```java
1517
public static final String AUTHENTICATION_ACTION;
@@ -41,7 +43,7 @@ public static final String CANCEL_ACTION;
4143

4244
Action sent when the user change its password
4345

44-
#### Lock Properties
46+
### Lock Properties
4547

4648
```java
4749
public boolean shouldUseWebView();
@@ -99,7 +101,7 @@ public boolean isFullscreen();
99101

100102
If Lock's activities should be displayed in Fullscreen. Default is `false`
101103

102-
#### Lock Methods
104+
### Lock Methods
103105

104106
```java
105107
public void setProvider(String serviceName, IdentityProvider provider);
@@ -113,11 +115,11 @@ public void resetAllProviders();
113115

114116
Removes all session information the Identity Provider handlers might have.
115117

116-
### Lock.Builder
118+
## Lock.Builder
117119

118120
A simple builder to help you create and configure Lock in your application.
119121

120-
#### Lock.Builder Constants
122+
### Lock.Builder Constants
121123

122124
```java
123125
public static final String CLIENT_ID_KEY = "com.auth0.lock.client-id";
@@ -143,7 +145,7 @@ public static final String CONFIGURATION_URL_KEY = "com.auth0.lock.configuration
143145

144146
Key value used by Lock to search in your application's meta-data for configuration Url.
145147

146-
#### Lock.Builder Methods
148+
### Lock.Builder Methods
147149

148150
```java
149151
public Builder clientId(String clientId);

articles/libraries/lock-android/v1/delegation-api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
toc_title: Delegation API
2+
toc: true
3+
title: Lock for Android v1 Delegation
34
description: Integrate with third-party apps with the delegation API.
45
---
56
# Lock Android: Delegation API

articles/libraries/lock-android/v1/error-messages.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

articles/libraries/lock-android/v1/index.md

Lines changed: 2 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
22
section: libraries
33
toc: true
4-
toc_title: Lock for Android v1
54
title: Lock for Android v1
65
description: A widget that provides a frictionless login and signup experience for your native Android apps.
76
mobileimg: media/articles/libraries/lock-android.png
87
---
9-
# Lock for Android
8+
# Lock Android: Getting Started
109

1110
<%= include('../_includes/_lock-version') %>
1211

@@ -109,9 +108,7 @@ android {
109108
}
110109
```
111110

112-
## Usage
113-
114-
### Email/Password, Enterprise & Social authentication
111+
## Authentication with Lock
115112

116113
`LockActivity` will handle Email/Password, Enterprise & Social authentication based on your Application's connections enabled in your Auth0's Dashboard.
117114

@@ -164,90 +161,6 @@ And you'll see our native login screen
164161
By default all social authentication will be done using an external browser, if you want native integration please check this [wiki page](/libraries/lock-android/native-social-authentication).
165162
:::
166163

167-
### Passwordless
168-
169-
`LockPasswordlessActivity` authenticates users by sending them an Email or SMS (similar to how WhatsApp authenticates you). In order to be able to authenticate the user, your application must have the SMS/Email connection enabled and configured in your [dashboard](${manage_url}/#/connections/passwordless).
170-
171-
`LockPasswordlessActivity` is not included in `com.auth0:lock:aar` as it's part of the library `lock-passwordless`, but you can add it with this line in your `build.gradle`:
172-
173-
```gradle
174-
compile 'com.auth0.android:lock-passwordless:1.+'
175-
```
176-
177-
Then in your `AndroidManifest.xml` register the following activities:
178-
179-
```xml
180-
<!--Auth0 Lock Passwordless-->
181-
<activity
182-
android:name="com.auth0.lock.passwordless.LockPasswordlessActivity"
183-
android:theme="@style/Lock.Theme"
184-
android:label="@string/app_name"
185-
android:screenOrientation="portrait"
186-
android:launchMode="singleTask"/>
187-
188-
<activity android:name="com.auth0.lock.passwordless.CountryCodeActivity"
189-
android:theme="@style/Lock.Theme"/>
190-
<!--Auth0 Lock Passwordless End-->
191-
```
192-
193-
Just like `LockActivity`, when a user authenticates successfully, `LockPasswordlessActivity` will send an `Action` using `LocalBroadcastManager` and then finish itself (by calling `finish()`). The activity that is interested in receiving this `Action` (in this case the one that will show Lock) needs to register a listener in the `LocalBroadcastManager`:
194-
195-
```java
196-
// This activity will show Lock
197-
public class HomeActivity extends Activity {
198-
private LocalBroadcastManager broadcastManager;
199-
200-
private BroadcastReceiver authenticationReceiver = new BroadcastReceiver() {
201-
@Override
202-
public void onReceive(Context context, Intent intent) {
203-
UserProfile profile = intent.getParcelableExtra(Lock.AUTHENTICATION_ACTION_PROFILE_PARAMETER);
204-
Token token = intent.getParcelableExtra(Lock.AUTHENTICATION_ACTION_TOKEN_PARAMETER);
205-
Log.i(TAG, "User " + profile.getName() + " logged in");
206-
}
207-
};
208-
209-
@Override
210-
protected void onCreate(Bundle savedInstanceState) {
211-
super.onCreate(savedInstanceState);
212-
//Customize your activity
213-
214-
broadcastManager = LocalBroadcastManager.getInstance(this);
215-
broadcastManager.registerReceiver(authenticationReceiver, new IntentFilter(Lock.AUTHENTICATION_ACTION));
216-
}
217-
218-
@Override
219-
protected void onDestroy() {
220-
super.onDestroy();
221-
broadcastManager.unregisterReceiver(authenticationReceiver);
222-
}
223-
}
224-
```
225-
226-
Then just start `LockPasswordlessActivity` specifying the Passwordless type you want to use, so for **Email**
227-
228-
```java
229-
LockPasswordlessActivity.showFrom(MyActivity.this, LockPasswordlessActivity.MODE_EMAIL_CODE);
230-
```
231-
232-
or just for **SMS**
233-
234-
```java
235-
LockPasswordlessActivity.showFrom(MyActivity.this, LockPasswordlessActivity.MODE_SMS_CODE);
236-
```
237-
238-
and you'll see the **SMS** login screen
239-
240-
![Lock Screenshot](/media/articles/libraries/lock-android/Lock-SMS-Android-Screenshot.png)
241-
242-
Passworless scenarios and types:
243-
244-
| Channel \ Mode | Code | Magic Link |
245-
| :-----: |:---------------:| :--------------: |
246-
| SMS | `LockPasswordlessActivity.MODE_SMS_CODE` | `LockPasswordlessActivity.MODE_SMS_LINK` |
247-
| Email | `LockPasswordlessActivity.MODE_EMAIL_CODE` | `LockPasswordlessActivity.MODE_EMAIL_LINK` |
248-
249-
You can find more information about Magic Links [here](/libraries/lock-android/passwordless-magic-link).
250-
251164
## Proguard
252165

253166
In the [proguard directory](https://github.com/auth0/Lock.Android/tree/master/proguard) you can find the *Proguard* configuration for Lock and its dependencies.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
section: libraries
3+
title: Lock Android v1 Internationalization
4+
description: Internationalization support in Lock for Android
5+
---
6+
# Lock Android: Internationalization
7+
8+
<%= include('../_includes/_lock-version') %>
9+
10+
By default, **Lock.Android** displays all text in English. If you wish to display text in another language, you may provide a `strings.xml` file and define values to be used for the various text items that Lock might display.
11+
12+
Android asks the device what _locale_ was configured by the user and tries to fetch the list of localized texts for that language. For this to work, the developer needs to add each translation file into the app by using a special folder naming convention as per Android standards. More information can be found in the [Android developer docs](https://developer.android.com/training/basics/supporting-devices/languages.html).
13+
14+
Some of the default values provided by Lock include:
15+
16+
```html
17+
<resources>
18+
<string name="sms_login_btn_text">Login SMS</string>
19+
<string name="no_login_text">Login not found</string>
20+
...
21+
</resources>
22+
```
23+
24+
By providing your own `strings.xml` file, these values can be adjusted as such:
25+
26+
```html
27+
<resources>
28+
<string name="sms_login_btn_text">Login with SMS</string>
29+
<string name="no_login_text">This user was not found!</string>
30+
...
31+
</resources>
32+
```
33+
34+
## Lock String Values
35+
36+
For a full list of the names used by Lock, see the [default strings.xml file](https://github.com/auth0/Lock.Android/blob/v1/app/src/main/res/values/strings.xml) in the Lock.Android repository.

articles/libraries/lock-android/v1/native-social-authentication.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
toc_title: Native Social Authentication
2+
title: Lock Android v1 Native Social Authentication
33
description: How to implement native social authentication with Lock Android
44
---
55
# Lock Android: Native Social Authentication

articles/libraries/lock-android/v1/passwordless-magic-link.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
---
2-
toc_title: Passwordless with Magic Link
2+
title: Lock Android v1 Passwordless with Magic Link
33
description: Passwordless with Magic Link with Lock Android
44
---
5-
# Lock Android: Passwordless with Magic Link
5+
# Lock Android: Passwordless Magic link
66

77
<%= include('../_includes/_lock-version') %>
88

99
::: warning
1010
Passwordless on native platforms is disabled by default for new tenants as of 8 June 2017. If you would like this feature enabled, please contact support to discuss your use case. See [Client Grant Types](/clients/client-grant-types) for more information. Alternatively, you can use Lock Passwordless on Auth0's [Hosted Login Page](/hosted-pages/login).
1111
:::
1212

13+
## Passwordless Authentication with Magic Link
14+
1315
In order to avoid asking the user to input the one-time password sent for passwordless authentication in Android apps, we introduced the ability to send a link that the user can tap to login without any code input involved.
1416

1517
These links include the same code that would be used in the traditional passwordless flow, but with the correct configuration they will be handled automatically by the Android system and our application will log in the users effortlessly by relying on **Android App Links**.
@@ -28,7 +30,7 @@ The links will work in all versions of Android, but the dialog asking the user w
2830

2931
In this article we'll show how Auth0 helps you set up your app to use app links to log in.
3032

31-
## Auth0 account configuration
33+
### Auth0 account configuration
3234

3335
Auth0 will generate the [Digital Asset Links](https://developers.google.com/digital-asset-links/) file automatically, all you need to do is configure the required parameters, some via API and others in your [dashboard](${manage_url}/#/connections/passwordless). We'll show you how to do it.
3436

@@ -74,9 +76,11 @@ In the *id* field we must introduce the *client_id* of our Auth0 App, and the *b
7476
Don't forget to change the body to use your package name and keystore fingerprint!
7577
:::
7678

79+
### Connection Configuration
80+
7781
Next we'll have to configure either the SMS or Email connection. This is available from the dashboard, so we'll show how to do it from there.
7882

79-
### SMS
83+
#### SMS
8084

8185
In case we'll use a passwordless connection via SMS, we'll need to update the SMS message template from the [dashboard](${manage_url}/#/connections/passwordless).
8286

@@ -94,7 +98,7 @@ Your verification code is: {{ code }}
9498
We assume that you have the SMS connection correctly configured, including the Twilio account. If you haven't, please do so.
9599
:::
96100

97-
### Email
101+
#### Email
98102

99103
Otherwise, if we'll use a passwordless connection via Email, we'll need to make sure the template is **HTML + Liquid** and that the email body contains *somewhere* a conditional like this:
100104

@@ -106,9 +110,9 @@ Your verification code is: {{ code }}
106110
{% endif %}
107111
```
108112

109-
## Application configuration
113+
### Application configuration
110114

111-
Now that we have the Auth0 client configured, before we start with the android configuration we must follow the instructions and set up Lock.Android and LockPasswordlessActivity as seen in the [passwordless docs](/libraries/lock-android#passwordless).
115+
Now that we have the Auth0 client configured, before we start with the Android configuration we must follow the instructions and set up Lock.Android and LockPasswordlessActivity as seen in the [passwordless docs](/libraries/lock-android#passwordless).
112116

113117
Now, in order to use App Links, there is an additional configuration step we must follow. We must declare an intent filter in the `AndroidManifest.xml`, inside the `LockPasswordlessActivity` activity tag. This filter will allow the app lo handle the links we'll send by Email or SMS.
114118

@@ -149,7 +153,7 @@ As can be seen, it's a regular *intent-filter*, with the exception of the `andro
149153

150154
Also notice that in case we'll only use one passwordless method (SMS or Email) you could delete the other intent filter (see the last segment of the pathPrefix: `/email` or `/sms`).
151155

152-
## Usage
156+
### Usage
153157

154158
As you should already know, `LockPasswordlessActivity` authenticates users by sending them an Email or SMS, in this case we'll send them a link instead of a code. The only difference w.r.t. the regular passwordless is that we now explicitly indicate that we will use magic/app links. This is accomplished using the appropiate mode.
155159

0 commit comments

Comments
 (0)