master
md 45 lines 941 Bytes
Rendered Raw
1 # WslcSessionAuthenticate
2
3 ```c
4 STDAPI WslcSessionAuthenticate(
5 _In_ WslcSession session,
6 _In_z_ PCSTR serverAddress,
7 _In_z_ PCSTR username,
8 _In_z_ PCSTR password,
9 _Outptr_result_z_ PSTR* identityToken,
10 _Outptr_opt_result_z_ PWSTR* errorMessage);
11 ```
12
13 | Parameter | Type | Direction |
14 |---|---|---|
15 | `session` | `WslcSession` | in |
16 | `serverAddress` | `PCSTR` | in |
17 | `username` | `PCSTR` | in |
18 | `password` | `PCSTR` | in |
19 | `identityToken` | `PSTR*` | out |
20 | `errorMessage` | `PWSTR*` | out, optional |
21
22 Return value: `HRESULT`.
23
24 Header note: `identityToken` is allocated using `CoTaskMemAlloc`; free it with `CoTaskMemFree`.
25
26 Example:
27
28 ```c
29 PSTR identityToken = NULL;
30 HRESULT hr = WslcSessionAuthenticate(
31 session,
32 "127.0.0.1:5000",
33 "user",
34 "password",
35 &identityToken,
36 NULL);
37
38 if (SUCCEEDED(hr))
39 {
40 printf("token=%s\n", identityToken);
41 CoTaskMemFree(identityToken);
42 }
43 ```
44
45 ---