blob: 5f07e87c0ff737fc5b02437f05d730a2337dfd68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <stdio.h>
#include <matrix.h>
#define SERVER FixedBuf("matrix.org")
#define USERNAME FixedBuf("@pscho:matrix.org")
#define PASSWORD FixedBuf("abcde")
int
main(
int argc,
char **argv)
{
MatrixClient client;
MatrixClientInit(&client, SERVER);
MatrixClientLoginPassword(&client,
USERNAME,
PASSWORD);
static char accessTokenCharBuffer[ACCESS_TOKEN_LEN];
FixedBuffer accessTokenBuffer = { accessTokenCharBuffer, ACCESS_TOKEN_LEN, 0 };
MatrixClientGetAccessToken(&client, &accessTokenBuffer);
printf("Access Token: %.*s\n", accessTokenBuffer.len, (char *)accessTokenBuffer.ptr);
return 0;
}
|