Exemple #1
0
        static async Task TokenAsync()
        {
            SCBOpenAPI.Authentication auth = new SCBOpenAPI.Authentication();

            auth.CreateTokenRequestHeader.ContentType     = "application/json";
            auth.CreateTokenRequestHeader.ResourceOwnerId = "<Your API Key>";
            auth.CreateTokenRequestHeader.RequestUId      = Guid.NewGuid().ToString();
            auth.CreateTokenRequestHeader.AcceptLanguage  = "EN";

            auth.CreateTokenRequestBody.applicationKey    = "<Your API Key>";
            auth.CreateTokenRequestBody.applicationSecret = "<Your API Secret>";
            auth.CreateTokenRequestBody.authCode          = null;
            auth.CreateTokenRequestBody.state             = null;
            auth.CreateTokenRequestBody.codeChallenge     = null;

            var resultToken = await auth.GetTokenAsync(auth.CreateTokenRequestHeader, auth.CreateTokenRequestBody);

            Console.WriteLine(resultToken.jsonString);
        }
Exemple #2
0
        public async Task <IActionResult> Index()
        {
            SCBOpenAPI.Authentication auth = new SCBOpenAPI.Authentication();

            auth.CreateTokenRequestHeader.ContentType     = "application/json";
            auth.CreateTokenRequestHeader.ResourceOwnerId = "<Your API Key>";
            auth.CreateTokenRequestHeader.RequestUId      = Guid.NewGuid().ToString();
            auth.CreateTokenRequestHeader.AcceptLanguage  = "EN";

            auth.CreateTokenRequestBody.applicationKey    = "<Your API Key>";
            auth.CreateTokenRequestBody.applicationSecret = "<Your API Secret>";
            auth.CreateTokenRequestBody.authCode          = null;
            auth.CreateTokenRequestBody.state             = null;
            auth.CreateTokenRequestBody.codeChallenge     = null;

            var resultToken = await auth.GetTokenAsync(auth.CreateTokenRequestHeader, auth.CreateTokenRequestBody);

            ViewBag.Results = resultToken.jsonString;

            return(View());
        }