4
4
*/
5
5
6
6
import {
7
- SignInCodeRequiredHandler ,
8
- SignInPasswordRequiredHandler ,
7
+ SignInCodeRequiredState ,
8
+ SignInPasswordRequiredState ,
9
9
UserNotFoundError ,
10
10
} from "@azure/msal-native-auth" ;
11
11
import { AccountInfo } from "@azure/msal-native-auth" ;
12
- import { SignInOptions } from "@azure/msal-native-auth" ;
12
+ import { SignInInputs } from "@azure/msal-native-auth" ;
13
13
import { NativeAuthConfiguration } from "@azure/msal-native-auth" ;
14
14
import { NativeAuthPublicClientApplication } from "@azure/msal-native-auth" ;
15
15
@@ -26,7 +26,7 @@ export async function signin(
26
26
27
27
const app = NativeAuthPublicClientApplication . create ( config ) ;
28
28
29
- const signInOptions : SignInOptions = {
29
+ const signInOptions : SignInInputs = {
30
30
username : username ,
31
31
password : password ,
32
32
} ;
@@ -48,7 +48,7 @@ export async function signin(
48
48
// Check if the flow is completed
49
49
if ( result . isFlowCompleted ( ) ) {
50
50
// Get the account info which can be used to get account data, tokens, and sign out.
51
- const accountManager : AccountInfo = result . resultData as AccountInfo ;
51
+ const accountManager : AccountInfo = result . data as AccountInfo ;
52
52
53
53
accountManager . getAccount ( ) ;
54
54
accountManager . getIdToken ( ) ;
@@ -59,11 +59,11 @@ export async function signin(
59
59
}
60
60
61
61
// code required
62
- if ( result . nextStateHandler instanceof SignInCodeRequiredHandler ) {
62
+ if ( result . state instanceof SignInCodeRequiredState ) {
63
63
// collect code from customer.
64
64
const code = "test-code" ;
65
65
66
- const submitCodeResult = await result . nextStateHandler . submitCode ( code ) ;
66
+ const submitCodeResult = await result . state . submitCode ( code ) ;
67
67
68
68
if ( ! submitCodeResult . isSuccess ) {
69
69
// handle error
@@ -73,7 +73,7 @@ export async function signin(
73
73
74
74
// Get the account manager which can be used to get account information, tokens, and sign out.
75
75
const accountManager : AccountInfo =
76
- submitCodeResult . resultData as AccountInfo ;
76
+ submitCodeResult . data as AccountInfo ;
77
77
78
78
accountManager . getAccount ( ) ;
79
79
accountManager . getIdToken ( ) ;
@@ -84,9 +84,9 @@ export async function signin(
84
84
}
85
85
86
86
// resend code and submit code
87
- if ( result . nextStateHandler instanceof SignInCodeRequiredHandler ) {
87
+ if ( result . state instanceof SignInCodeRequiredState ) {
88
88
// resend code
89
- const resendCodeResult = await result . nextStateHandler . resendCode ( ) ;
89
+ const resendCodeResult = await result . state . resendCode ( ) ;
90
90
91
91
if ( ! resendCodeResult . isSuccess ) {
92
92
// handle error
@@ -98,7 +98,7 @@ export async function signin(
98
98
const code = "test-code" ;
99
99
100
100
const submitCodeResult = await (
101
- resendCodeResult . nextStateHandler as SignInCodeRequiredHandler
101
+ resendCodeResult . state as SignInCodeRequiredState
102
102
) . submitCode ( code ) ;
103
103
104
104
if ( ! submitCodeResult . isSuccess ) {
@@ -109,7 +109,7 @@ export async function signin(
109
109
110
110
// Get the account manager which can be used to get account information, tokens, and sign out.
111
111
const accountManager : AccountInfo =
112
- submitCodeResult . resultData as AccountInfo ;
112
+ submitCodeResult . data as AccountInfo ;
113
113
114
114
accountManager . getAccount ( ) ;
115
115
accountManager . getIdToken ( ) ;
@@ -120,11 +120,10 @@ export async function signin(
120
120
}
121
121
122
122
// password required
123
- if ( result . nextStateHandler instanceof SignInPasswordRequiredHandler ) {
123
+ if ( result . state instanceof SignInPasswordRequiredState ) {
124
124
// collect password from customer.
125
125
const pwd = "test-password" ;
126
- const submitPasswordResult =
127
- await result . nextStateHandler . sumbmitPassword ( pwd ) ;
126
+ const submitPasswordResult = await result . state . sumbmitPassword ( pwd ) ;
128
127
129
128
if ( ! submitPasswordResult . isSuccess ) {
130
129
// handle error
@@ -134,7 +133,7 @@ export async function signin(
134
133
135
134
// Get the account manager which can be used to get account information, tokens, and sign out.
136
135
const accountManager : AccountInfo =
137
- submitPasswordResult . resultData as AccountInfo ;
136
+ submitPasswordResult . data as AccountInfo ;
138
137
139
138
accountManager . getAccount ( ) ;
140
139
accountManager . getIdToken ( ) ;
0 commit comments