Blaze.Controllers.OAuthService.GetInfo C# (CSharp) Method

GetInfo() public method

public GetInfo ( string accessToken ) : AuthorizationReply
accessToken string
return AuthorizationReply
        public AuthorizationReply GetInfo(string accessToken)
        {
            var request = new RestRequest("/authorization.json");
            request.AddHeader("Authorization", "Bearer " + accessToken);
            var client = new RestClient(LaunchpadBaseUrl);
            var reply = client.Execute<AuthorizationReply>(request);
            return reply.Data;
        }

Usage Example

Example #1
0
        public ActionResult Chat(string accountName, string code, string auth)
        {
            var info = oAuthService.GetInfo(auth);

            Log.Info("Info received from auth: {0}", JsonConvert.SerializeObject(info));
            switch (info.Accounts.Count(x => x.Product == "campfire"))
            {
            case 0:
                Log.Info("No Campfire accounts. Info received from auth: {0}", JsonConvert.SerializeObject(info));
                return(View("NoCampfireAccounts"));

            default:
                ViewBag.Accounts = info.Accounts.Where(x => x.Product == "campfire").Select(GetAccountName);
                break;
            }

            ViewBag.Stealth = Convert.ToBoolean(ConfigurationManager.AppSettings["Stealth"] ?? "true")
                                  ? "true"
                                  : "false";
            return(View("Chat"));
        }