Exemple #1
0
        public async Task LoginWithAuthData()
        {
            string uuid = Guid.NewGuid().ToString();
            Dictionary <string, object> authData = new Dictionary <string, object> {
                { "expires_in", 7200 },
                { "openid", uuid },
                { "access_token", uuid }
            };
            LCUser currentUser = await LCUser.LoginWithAuthData(authData, "weixin");

            TestContext.WriteLine(currentUser.SessionToken);
            Assert.NotNull(currentUser.SessionToken);
            string userId = currentUser.ObjectId;

            TestContext.WriteLine($"userId: {userId}");
            TestContext.WriteLine(currentUser.AuthData);

            await LCUser.Logout();

            currentUser = await LCUser.GetCurrent();

            Assert.IsNull(currentUser);

            currentUser = await LCUser.LoginWithAuthData(authData, "weixin");

            TestContext.WriteLine(currentUser.SessionToken);
            Assert.NotNull(currentUser.SessionToken);
            Assert.AreEqual(currentUser.ObjectId, userId);
            TestContext.WriteLine(currentUser.AuthData);
        }