@@ -101,11 +101,11 @@ Next, add the `LockActivity` inside the `application` tag:
101
101
102
102
``` xml
103
103
<activity
104
- android : name =" com.auth0.android.lock.LockActivity"
105
- android : label =" @string/app_name"
106
- android : launchMode =" singleTask"
107
- android : screenOrientation =" portrait"
108
- android : theme =" @style/Lock.Theme" />
104
+ android : name =" com.auth0.android.lock.LockActivity"
105
+ android : label =" @string/app_name"
106
+ android : launchMode =" singleTask"
107
+ android : screenOrientation =" portrait"
108
+ android : theme =" @style/Lock.Theme" />
109
109
```
110
110
111
111
Make sure the Activity's ` launchMode ` is declared as ` singleTask ` or the authentication result won't come back into your application.
@@ -117,37 +117,37 @@ Then, in any of your Activities, you need to initialize **Lock** and handle the
117
117
// This activity will show Lock
118
118
class MyActivity : AppCompatActivity () {
119
119
120
- private var lock: Lock ? = null
120
+ private var lock: Lock ? = null
121
121
122
- override fun onCreate (savedInstanceState : Bundle ? ) {
123
- super .onCreate(savedInstanceState)
122
+ override fun onCreate (savedInstanceState : Bundle ? ) {
123
+ super .onCreate(savedInstanceState)
124
124
125
- val account = Auth0 (this )
126
- // Instantiate Lock once
127
- lock = Lock .newBuilder(account, callback)
128
- // Customize Lock
129
- .build(this )
130
- }
131
-
132
- override fun onDestroy () {
133
- super .onDestroy()
134
- // Important! Release Lock and its resources
135
- lock?.onDestroy(this )
136
- }
137
-
138
- private val callback = object : AuthenticationCallback () {
139
- override fun onAuthentication (credentials : Credentials ) {
125
+ val account = Auth0 (this )
126
+ // Instantiate Lock once
127
+ lock = Lock .newBuilder(account, callback)
128
+ // Customize Lock
129
+ .build(this )
130
+ }
131
+
132
+ override fun onDestroy () {
133
+ super .onDestroy()
134
+ // Important! Release Lock and its resources
135
+ lock?.onDestroy(this )
136
+ }
137
+
138
+ private val callback = object : AuthenticationCallback () {
139
+ override fun onAuthentication (credentials : Credentials ) {
140
140
// Authenticated
141
- }
142
-
143
- override fun onCanceled () {
141
+ }
142
+
143
+ override fun onCanceled () {
144
144
// User pressed back and closed Lock
145
- }
146
-
147
- override fun onError (error : LockException ) {
145
+ }
146
+
147
+ override fun onError (error : LockException ) {
148
148
// An exception occurred
149
- }
150
- }
149
+ }
150
+ }
151
151
}
152
152
```
153
153
@@ -174,22 +174,21 @@ Next, add the `PasswordlessLockActivity` inside the `application` tag. Note that
174
174
175
175
``` xml
176
176
<activity
177
- android : name =" com.auth0.android.lock.PasswordlessLockActivity"
178
- android : label =" @string/app_name"
179
- android : launchMode =" singleTask"
180
- android : screenOrientation =" portrait"
181
- android : theme =" @style/Lock.Theme" >
177
+ android : name =" com.auth0.android.lock.PasswordlessLockActivity"
178
+ android : label =" @string/app_name"
179
+ android : launchMode =" singleTask"
180
+ android : screenOrientation =" portrait"
181
+ android : theme =" @style/Lock.Theme" >
182
182
<intent-filter >
183
- <action android : name =" android.intent.action.VIEW" />
184
-
185
- <category android : name =" android.intent.category.DEFAULT" />
186
- <category android : name =" android.intent.category.BROWSABLE" />
187
-
188
- <data
183
+ <action android : name =" android.intent.action.VIEW" />
184
+
185
+ <category android : name =" android.intent.category.DEFAULT" />
186
+ <category android : name =" android.intent.category.BROWSABLE" />
187
+
188
+ <data
189
189
android : host =" @string/com_auth0_domain"
190
190
android : pathPrefix =" /android/${applicationId}/email"
191
191
android : scheme =" https" />
192
-
193
192
</intent-filter >
194
193
</activity >
195
194
```
@@ -202,8 +201,8 @@ When the Passwordless connection is SMS you must also add the `CountryCodeActivi
202
201
203
202
``` xml
204
203
<activity
205
- android : name =" com.auth0.android.lock.CountryCodeActivity"
206
- android : theme =" @style/Lock.Theme.ActionBar" />
204
+ android : name =" com.auth0.android.lock.CountryCodeActivity"
205
+ android : theme =" @style/Lock.Theme.ActionBar" />
207
206
```
208
207
209
208
@@ -212,38 +211,38 @@ Then, in any of your Activities, you need to initialize **PasswordlessLock** and
212
211
``` kotlin
213
212
// This activity will show PasswordlessLock
214
213
class MyActivity : AppCompatActivity () {
215
-
216
- private var lock: PasswordlessLock ? = null
217
-
218
- override fun onCreate (savedInstanceState : Bundle ? ) {
219
- super .onCreate(savedInstanceState)
220
214
221
- val account = Auth0 (this )
222
- // Instantiate Lock once
223
- lock = PasswordlessLock .newBuilder(account, callback)
224
- // Customize Lock
225
- .build(this )
226
- }
227
-
228
- override fun onDestroy () {
229
- super .onDestroy()
230
- // Important! Release Lock and its resources
231
- lock?.onDestroy(this )
232
- }
233
-
234
- private val callback = object : AuthenticationCallback () {
235
- override fun onAuthentication (credentials : Credentials ) {
215
+ private var lock: PasswordlessLock ? = null
216
+
217
+ override fun onCreate (savedInstanceState : Bundle ? ) {
218
+ super .onCreate(savedInstanceState)
219
+
220
+ val account = Auth0 (this )
221
+ // Instantiate Lock once
222
+ lock = PasswordlessLock .newBuilder(account, callback)
223
+ // Customize Lock
224
+ .build(this )
225
+ }
226
+
227
+ override fun onDestroy () {
228
+ super .onDestroy()
229
+ // Important! Release Lock and its resources
230
+ lock?.onDestroy(this )
231
+ }
232
+
233
+ private val callback = object : AuthenticationCallback () {
234
+ override fun onAuthentication (credentials : Credentials ) {
236
235
// Authenticated
237
- }
238
-
239
- override fun onCanceled () {
236
+ }
237
+
238
+ override fun onCanceled () {
240
239
// User pressed back and closed Lock
241
- }
242
-
243
- override fun onError (error : LockException ) {
240
+ }
241
+
242
+ override fun onError (error : LockException ) {
244
243
// An exception occurred
245
- }
246
- }
244
+ }
245
+ }
247
246
}
248
247
```
249
248
@@ -266,14 +265,14 @@ newBuilder(account, callback)
266
265
.withScope(' new-scope' ) // Changes the scope to be requested on authentication
267
266
.withAudience(' my-api' ) // Changes the audience to be requested on authentication
268
267
.withScheme(' myapp' ) // Changes the scheme part used to generate the Callback URL (more below)
269
-
268
+
270
269
// Lock specific options
271
270
.initialScreen(InitialScreen .SIGN_UP ) // Allows to choose the screen to be displayed first
272
271
.allowLogIn(false ) // Disables the Log In screen
273
272
.allowSignUp(false ) // Disables the Sign Up screen
274
273
.allowForgotPassword(false ) // Disables the Change Password screen
275
274
.setDefaultDatabaseConnection(' my-connection' ) // When multiple are available, select one
276
-
275
+
277
276
// PasswordlessLock specific options
278
277
.useCode(true ) // Requests to receive a OTP that will need to be filled in your android app to authenticate the user
279
278
.useLink(false ) // Requests to receive a link that will open your android app to authenticate the user
0 commit comments