abouttreesummaryrefslogcommitdiff
path: root/examples/Login.c
blob: 08f981af0d582c66b4c2150e11e55044e60c61a6 (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
28
29
30
31
#include <stdio.h>
#include <matrix.h>

#define SERVER      "https://matrix.org"
#define USERNAME    "pscho"
#define PASSWORD    "Wc23EbmB9G3faMq"
#define DISPLAYNAME "MatrixClient"


int
main(void)
{
    MatrixClient client;
    MatrixClientInit(&client);
    
    MatrixHttpInit(&client.hc, SERVER);

    MatrixClientLoginPassword(&client,
        USERNAME,
        PASSWORD,
        DISPLAYNAME);

    printf("Access Token: %s\n", client.accessToken);
    printf("Device ID: %s\n", client.deviceId);
    printf("Expires in (ms): %s\n", client.expireMs);
    printf("Refresh Token: %s\n", client.refreshToken);
    
    MatrixHttpDeinit(&client.hc);

    return 0;
}