Reputation: 111
Im facing an issue to handle the auth0 pop window. Any leads on how do I handle the same.
NOTE : 1. Protractor is what I'm using. 2. Framework : Jasmine (Nodejs).
Attached is the screenshot for the reference.
Thanks, Zaid
Upvotes: 1
Views: 759
Reputation: 111
Finally figured out the solution.
I have a javascript that generates the auth0 token. Once the token is generated I use that token and set that to browser cookies along with user credential. This way when I hit the application url which I want to test, the auth0 browser specific authentication prompt isn't displayed.
Below is the code for the same: var request = require('request');
this.performAuthoLogin = function() {
var defer = protractor.promise.defer();
var credentials = {
"client_id": clientId,
"username": userName,
"password": password,
"id_token": "",
"connection": connectionName,
"grant_type": "password",
"scope": "openid",
"device": "api"
}
request({
url: url,
method: 'POST',
json: true,
body: credentials,
headers: {
'Content-Type': 'application/json'
}
}, function(error, response, body) {
if (error) {
defer.reject(error);
} else {
authTokenId = body.id_token;
console.log(authTokenId);
var profile = {
username: userNameToLogin
email: emailId
}
browser.manage().addCookie("profile", profile, '/', applicationUrl)
browser.manage().addCookie("id_token", authTokenId, '/', applicationUrl);
defer.fulfill(body);
}
});
return defer.promise;
};
Upvotes: 2