protected override void OnInit(EventArgs e) { base.OnInit(e); IsLoggedIn = _authorizer.IsAuthorized(); if (!IsLoggedIn) { Uri authurl = _authorizer.GetLoginUrl(new HttpRequestWrapper(Request)); CanvasRedirect(authurl.ToString()); } else { FacebookUserId = _facebookApp.UserId; AccessToken = _facebookApp.Session.AccessToken; using (IAchievementManager manager = new AchievementManager()) { User user = manager.GetUser(FacebookUserId); if (user != null) { SteamUserId = user.SteamUserId; } } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (Session["FacebookUserId"] == null) { FacebookApp facebookApp = new FacebookApp(); CanvasAuthorizer authorizor = new CanvasAuthorizer(facebookApp); authorizor.ReturnUrlPath = "default.aspx"; authorizor.Perms = "publish_stream"; //,offline_access authorizor.Authorize(Request, Response); IsLoggedIn = authorizor.IsAuthorized(); if (IsLoggedIn) { Session["FacebookUserId"] = facebookApp.UserId; } else { Session["FacebookUserId"] = 0; } } FacebookUserId = (long)Session["FacebookUserId"]; IsLoggedIn = FacebookUserId > 0; }
public bool IsAuthorized() { return(_authorizer.IsAuthorized()); }