コード例 #1
0
        public async Task <AuthError> Regist()
        {
            var ret        = AuthError.E_CHAOS;
            var authClient = new AuthClient(config.apiInfo.list.FirstOrDefault(p => p.name == "auth").url,
                                            config.apiInfo.key);
            var resp = await authClient.Regist();

            errno = (AuthError)Enum.Parse(typeof(AuthError), resp.status, true);

            Debug.Log("Auth::Regist : " + resp.status + " [ " + resp.meta + " ]");

            if (errno == AuthError.E_OK)
            {
                sessCode    = resp.sessCode;
                userProfile = resp.userProfile;
            }

            ret = errno;

            return(ret);
        }
コード例 #2
0
        async Task <AuthData.Response> ClientJob(LambdaAuthArg data, ILambdaContext ctx)
        {
            AuthData.Response ret = null;

            var env     = System.Environment.GetEnvironmentVariable("LAMBDA_ENV");
            var service = System.Environment.GetEnvironmentVariable("LAMBDA_SERVICE");

            data.apiUrl = System.Environment.GetEnvironmentVariable("DEBUG_API_URL");
            data.apiKey = System.Environment.GetEnvironmentVariable("DEBUG_API_KEY");

            var authClient = new AuthClient(data.apiUrl, data.apiKey, ctx);

            if (data.mode == "regist")
            {
                ret = await authClient.Regist();
            }
            else if (data.mode == "login")
            {
                ret = await authClient.Login(data.userProfile.guid);
            }
            else if (data.mode == "createTakeoverCode")
            {
                ret = await authClient.CreateTakeoverCode(data.userProfile.uid, data.sessCode);
            }
            else if (data.mode == "consumeTakeoverCode")
            {
                ret = await authClient.ConsumeTakeoverCode(data.userProfile.uid, data.takeoverCode);
            }
            else
            {
                ret = await Task.Run(() => { return(new AuthData.Response()
                    {
                        status = AuthError.E_CHAOS.ToString()
                    }); });
            }

            return(ret);
        }