Skip to content

Instantly share code, notes, and snippets.

@AmyrAhmady
Created January 30, 2020 09:40
Show Gist options
  • Save AmyrAhmady/19ba30d894595ac7209b108b5b8a7f81 to your computer and use it in GitHub Desktop.
Save AmyrAhmady/19ba30d894595ac7209b108b5b8a7f81 to your computer and use it in GitHub Desktop.
mamad
using InstagramApiSharp.API.Builder;
using InstagramApiSharp.API;
using InstagramApiSharp;
using InstagramApiSharp.Classes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Threading.Tasks;
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
IInstaApi InstaApi;
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public async Task<ActionResult> Contact()
{
await Login();
var currentUser = await InstaApi.UserProcessor.GetCurrentUserAsync();
ViewBag.Message = "Your contact page. " + currentUser.Value.Email;
return View();
}
public async Task<IResult<InstaLoginResult>> Login()
{
var user = new UserSessionData();
user.UserName = "horiasghari";
user.Password = "321654hori";
InstaApi = InstaApiBuilder.CreateBuilder()
.SetUser(user)
.Build();
return await InstaApi.LoginAsync();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment