I got a sample from github , In that sample when we click a link it will be redirected to the salesforce login page.but when i click login after giving login credentials it's not authenticating . I am getting 401 error . Even i referred this link Salesforce Authentication Failing Not getting solution for my problem . i have tried like this
openLogin: function () {
var clientId = "xxx";
var consumerSecret = "xxx";
//Authorization endpoint
var authEndPoint = "https://login.salesforce.com/services/oauth2/authorize";
//response_type must be set to token
var responseType = "xxx";
//This is the callback URL from the connected app
var redirectURI = "xxxx";
var username="xxxx";
var password="xxx";
username=encodeURI(username);
password=encodeURI(password);
var requestURL = authEndPoint+'?response_type=code&grant_type=password&client_id='+clientId+'&response_type='+responseType+'&redirect_uri='+redirectURI+'&username='+username+'&password='+password;
var res = encodeURI(requestURL);
$window.open(requestURL);
}
But when new window is opening the requested page doesn't appear .
Please help me if you know the solution .