asp.net-mvcbasecamp

How to get access to Basecamp user detail using OAuth 2.0


I'm trying to get login using base camp as MVC project gives use Google facebook etc how can I get log in using my basecamp credentials


Solution

  • There are a lot of ways to implement that but the old is gold use BasecampRestAPI Its very easy to implement for example: Lets first authenticate the user

     public static bool Authenticate(string username, string password)
    {
    
    
            BaseCamp objCamp = BaseCamp.GetInstance("https://CompanyName.basecamp.com", username, password);
    
            // as we authenticated, therefore pass username after formatting it i.e. converting "Khawaja.Atteeq" to "Khawaja Atteeq" format
            string user = username.Split('@')[0].Replace('.', ' ');
            user = new CultureInfo("en").TextInfo.ToTitleCase(user.ToLower());
    
            //  session if necessary.
            HttpContext.Current.Session["UserID"] = user;
            return true;
        }
    

    Now lets go to the login page

     protected void SignIn_Click(object sender, EventArgs e)
    {
        if (Authenticate(Username.Text.Trim(), Password.Text))
        {
            Response.Redirect("~/");
        }
        else
        {
            Error.Visible = true;
        }
    }
    

    Thats It Hope This helps