@@ -222,16 +222,120 @@ signInWithRedirect({
222
222
</InlineFilter >
223
223
<InlineFilter filters = { [" android" ]} >
224
224
225
- { /* @todo */ }
225
+ { /* @todo update with explicit provider name */ }
226
+
227
+ <BlockSwitcher >
228
+ <Block name = " Java" >
229
+
230
+ ``` java
231
+ Amplify . Auth . signInWithWebUI(
232
+ this ,
233
+ result - > Log . i(" AuthQuickStart" , result. toString()),
234
+ error - > Log . e(" AuthQuickStart" , error. toString())
235
+ );
236
+ ```
237
+
238
+ </Block >
239
+ <Block name = " Kotlin - Callbacks" >
240
+
241
+ ``` kotlin
242
+ Amplify .Auth .signInWithWebUI(
243
+ this ,
244
+ { Log .i(" AuthQuickStart" , " Signin OK = $it " ) },
245
+ { Log .e(" AuthQuickStart" , " Signin failed" , it) }
246
+ )
247
+ ```
248
+
249
+ </Block >
250
+ <Block name = " Kotlin - Coroutines" >
251
+
252
+ ``` kotlin
253
+ try {
254
+ val result = Amplify .Auth .signInWithWebUI(this )
255
+ Log .i(" AuthQuickStart" , " Signin OK: $result " )
256
+ } catch (error: AuthException ) {
257
+ Log .e(" AuthQuickStart" , " Signin failed" , error)
258
+ }
259
+ ```
260
+
261
+ </Block >
262
+ <Block name = " RxJava" >
263
+
264
+ ``` java
265
+ RxAmplify . Auth . signInWithWebUI(this )
266
+ .subscribe(
267
+ result - > Log . i(" AuthQuickStart" , result. toString()),
268
+ error - > Log . e(" AuthQuickStart" , error. toString())
269
+ );
270
+ ```
271
+
272
+ </Block >
273
+ </BlockSwitcher >
226
274
227
275
</InlineFilter >
228
276
<InlineFilter filters = { [" flutter" ]} >
229
277
230
- { /* @todo */ }
278
+ ``` dart
279
+ Future<void> signInWithMicrosoftEntraID() async {
280
+ try {
281
+ final result = await Amplify.Auth.signInWithWebUI(
282
+ provider: AuthProvider.custom("MicrosoftEntraIDSAML"),
283
+ );
284
+ safePrint('Sign in result: $result');
285
+ } on AuthException catch (e) {
286
+ safePrint('Error signing in: ${e.message}');
287
+ }
288
+ }
289
+ ```
231
290
232
291
</InlineFilter >
233
292
<InlineFilter filters = { [" swift" ]} >
234
293
235
- { /* @todo */ }
294
+ <BlockSwitcher >
295
+ <Block name = " Async/Await" >
296
+
297
+ ``` swift
298
+ func signInWithMicrosoftEntraID () async {
299
+ do {
300
+ let signInResult = try await Amplify.Auth .signInWithWebUI (
301
+ for : AuthProvider.custom (" MicrosoftEntraIDSAML" ),
302
+ presentationAnchor : self .view .window !
303
+ )
304
+ if signInResult.isSignedIn {
305
+ print (" Sign in succeeded" )
306
+ }
307
+ } catch let error as AuthError {
308
+ print (" Sign in failed \( error ) " )
309
+ } catch {
310
+ print (" Unexpected error: \( error ) " )
311
+ }
312
+ }
313
+ ```
314
+
315
+ </Block >
316
+ <Block name = " Combine" >
317
+
318
+ ``` swift
319
+ func signInWithMicrosoftEntraID () -> AnyCancellable {
320
+ Amplify.Publisher .create {
321
+ try await Amplify.Auth .signInWithWebUI (
322
+ for : AuthProvider.custom (" MicrosoftEntraIDSAML" ),
323
+ presentationAnchor : self .view .window !
324
+ )
325
+ }
326
+ .sink { completion in
327
+ if case let .failure (authError) = completion {
328
+ print (" Sign in failed \( authError ) " )
329
+ }
330
+ } receiveValue : { signInResult in
331
+ if signInResult.isSignedIn {
332
+ print (" Sign in succeeded" )
333
+ }
334
+ }
335
+ }
336
+ ```
337
+
338
+ </Block >
339
+ </BlockSwitcher >
236
340
237
341
</InlineFilter >
0 commit comments