on 12-30-2014 7:03 AM
Hi,
We are developing a kapsel application by following this link
http://scn.sap.com/docs/DOC-49592
we have declared the authentication as HTTPs authentication with the odata end point and SSO Mechanism as Technical User Basic(username,password as the odata endpoint credentials)
After entering the credentials in the login screen We are getting a 401 unauthorised error
The following is the log trace:
#2.0#2014-12-30 06:29:11.042#+0:00#ERROR#Registration#401##Other#1419920950678002#a92f3828-99e1-484a-aa15-5bbeee93687d#com.olam.logintest#com.sap.mobile.platform.server.online.filter.application.AbstractSMPApplicationSettingsHandler:doFilter########705###Unauthorized#
#2.0#2014-12-30 06:29:11.042#+0:00#FATAL#Other####1419920950678000#a92f3828-99e1-484a-aa15-5bbeee93687d#com.olam.logintest#GeneratedMethodAccessor221:invoke########705###Unauthorized#
#2.0#2014-12-30 06:29:11.04#+0:00#DEBUG#Registration###Security#1419920950678001#a92f3828-99e1-484a-aa15-5bbeee93687d#com.olam.logintest#com.sap.mobile.platform.server.foundation.security.filter.AuthenticationFilter:doFilter########705###No AuthenticationEntryPoint was set during login attempt. Falling back to HTTP 401 + WWW-Authenticate#
#2.0#2014-12-30 06:29:10.794#+0:00#DEBUG#Registration###Security#1419920950678000#a92f3828-99e1-484a-aa15-5bbeee93687d#com.olam.logintest#com.sap.mobile.platform.server.foundation.security.filter.AuthenticationFilter:doFilter########705###authfilter-1: Security Configuration set to: 'LoginHttp'#
Kindly advise.
Hi Dinesh..
Did u manage to solve the error.
am also facing same issue
com.sap.mobile.platform.server.online.filter.application.AbstractSMPApplicationSettingsHandler:doFilter########705###Unauthorized#
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dinesh,
Am using SMP 3.0 SP05.Normal without Authentication Challenge it works fine and device gets registered.
End Point URL Pinged Sucessfully.
But Using LDAP Option it throws the bellow error.
#+0300#ERROR#com.sap.mobile.platform.server.online.filter.application.SMPOnPremiseApplicationSettingsHandler##anonymous#http-bio-8080-exec-2####69c000ef-a5e6-4d97-9b85-7bbc75cf2f1d#com.mycompany.logon#null#error#Other#null#null#7b266eca-1eaa-4795-acf9-44c2cec97d24#null#1426482856158#null#com.sap.mobile.platform.server.online.filter.application.AbstractSMPApplicationSettingsHandler:
doFilter#Unauthorized#null#824#Registration#1426493653739000#401 |
Hi Carol,
Are you using proxy server? if you are using proxy, provide the Non-proxy hosts in HTTP PROXY SETTINGS otherwise give the Non-proxy hosts as *.
To Configure the Non-proxy hosts,
Login to SMP Mannagement cockpit -> Settings -> System -> HTTP PROXY SETTINGS -> give the below details
HTTP proxy host -- proxy
HTTP proxy port -- 8080
HTTPS proxy host -- proxy
HTTPS proxy port -- 8080
Non-proxy hosts -- *
Let me know if you are facing issues again.
Regards,
Dinesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes. we have tried with register3.html as given in the document.
Please find below the index.html.
<html>
<head>
<script src="datajs-1.1.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script>
applicationContext = null;
window.onerror = onError;
var appId = "com.atest.login"; // app id
// Optional initial connection context
var context = {
"serverHost": "", //Our SMP 3.0 server IP here
"https": "false",
"serverPort": "8080",
"user": "", // USER NAME for the OData Endpoint here
"password": "", // PASSWORD for the OData Endpoint here
//once set can be changed by calling sap.Logon.changePassword()
"communicatorId": "REST",
"passcode": "", //note hardcoding passwords and unlock passcodes are strictly for ease of use during development
"unlockPasscode": "",
"passcode_CONFIRM":"",
"ssoPasscode":""
};
function onError(msg, url, line) {
var idx = url.lastIndexOf("/");
var file = "unknown";
if (idx > -1) {
file = url.substring(idx + 1);
}
alert("An error occurred in " + file + " (at line # " + line + "): " + msg);
return false; //suppressErrorAlert;
}
function init() {
if (sap.Logger) {
sap.Logger.setLogLevel(sap.Logger.DEBUG); //enables the display of debug log messages from the Kapsel plugins.
sap.Logger.debug("Log level set to DEBUG");
}
sap.Logon.init(logonSuccessCallback, logonErrorCallback, appId, context);
console.log("init completed");
}
function logonSuccessCallback(result) {
console.log("logonSuccessCallback " + JSON.stringify(result));
applicationContext = result;
showScreen("MainDiv");
}
function logonErrorCallback(error) { //this method is called if the user cancels the registration.
console.log("An error occurred: " + JSON.stringify(error));
if (device.platform == "Android") { //Not supported on iOS
navigator.app.exitApp();
}
}
function read() {
if (!applicationContext) {
alert("Register or unlock before proceeding");
return;
}
sUrl = applicationContext.applicationEndpointURL + "/zuname?BNAME=%27IN_USER%27"; //JSON format is less verbose than atom/xml
var oHeaders = {};
oHeaders['Authorization'] = "Basic " + btoa(applicationContext.registrationContext.user + ":" + applicationContext.registrationContext.password);
oHeaders['X-SMP-APPCID'] = applicationContext.applicationConnectionId;
var request = {
headers : oHeaders,
requestUri : sUrl,
method : "GET"
};
OData.read(request, readSuccessCallback, errorCallback);
}
function readSuccessCallback(data, response) {
var carrierTable = document.getElementById("carrierTable");
for (var i = data.results.length -1; i >= 0; i--) {
var row = carrierTable.insertRow(1);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
cell1.innerHTML = data.results[i].Ebeln;
cell2.innerHTML = data.results[i].Ekgrp;
}
}
function clearTable() {
var carrierTable = document.getElementById("carrierTable");
while(carrierTable.rows.length > 1) {
carrierTable.deleteRow(1);
}
}
function errorCallback(e) {
alert("An error occurred: " + JSON.stringify(e));
showScreen("MainDiv");
}
function register() {
sap.Logon.init(logonSuccessCallback, logonErrorCallback, appId, context);
}
function unRegister() {
sap.Logon.core.deleteRegistration(logonUnregisterSuccessCallback, errorCallback);
clearTable();
}
function logonUnregisterSuccessCallback(result) {
alert("Successfully Unregistered");
console.log("logonUnregisterSuccessCallback " + JSON.stringify(result));
applicationContext = null;
}
function lock() {
sap.Logon.lock(logonLockSuccessCallback, errorCallback);
clearTable();
}
function logonLockSuccessCallback(result) {
console.log("logonLockSuccessCallback " + JSON.stringify(result));
applicationContext = null;
showScreen("LockedDiv"); //sap.Logon.unlock(function () {},function (error) {});
//alternatively show the unlock screen
}
function unlock() {
sap.Logon.unlock(logonSuccessCallback, errorCallback);
}
function showScreen(screenIDToShow) {
var screenToShow = document.getElementById(screenIDToShow);
screenToShow.style.display = "block";
var screens = document.getElementsByClassName('screenDiv');
for (var i = 0; i < screens.length; i++) {
if (screens[i].id != screenToShow.id) {
screens[i].style.display = "none";
}
}
}
document.addEventListener("deviceready", init, false);
</script>
</head>
<body>
<div class="screenDiv" id="LoadingDiv">
<h1>Loading ...</h1>
</div>
<div class="screenDiv" id="LockedDiv" style="display: none">
<h1>Locked</h1>
<button id="unlock" onclick="unlock()">Unlock</button>
</div>
<div class="screenDiv" id="MainDiv" style="display: none">
<h1>Logon Sample 3</h1>
<button id="register" onclick="register()">Register</button>
<button id="read" onclick="read()">Read</button>
<button id="unregister" onclick="unRegister()">Unregister</button>
<button id="lock" onclick="lock()">Lock</button>
<button id="unlock" onclick="unlock()">Unlock</button>
<table id="carrierTable"><tr><th>Carrier ID</th><th>Carrier Name</th></tr></table>
</div>
</body>
</html>
Hi Dinesh,
Are you able to ping application id in the admin cockpit? Are you able to see "Backend system reached successfully" response?
Have you tried with register2.html index file as attached in this link ? Are you able to register to SMP server?
As your OData Endpoint is HTTPS, have you imported certificate in SMP3 keystore?
Regards,
JK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In general, URL should be similar to
http://sapes1.sapdevcenter.com:8080/sap/opu/odata/iwbep/gwdemo/
Are you testing this app in emulator or device? Can you check if you are able to hit http://smpserverip:8080 in device/emulator browser?
HI jitendra,
Our URL is in the same way.
We are testing the application in Device.
yes we are able to hit the url http://smpserverip:8080 in browser . it shows our smpversion.
We are having this issue when we upgraded our server from smp3sp3 to SMP3Sp5.
IN SMP3SP3 it was working fine but in sp5 we are getting this 401 error.
I just tried with HTTP/HTTPS authentication sec profile and i am able to register and able to read backend info on android device.
What i have done:
Setting up the application id in Admin cockpit:
1. Backend URLhttps://sapes1.sapdevcenter.com/sap/opu/odata/IWFND/RMTSAMPLEFLIGHT
2. Selected SSO as BASIC
3. Authentication > HTTP/HTTPS authentication
4. Able to ping the app id
I tried with register3.html file attached in this document, here you have to provide backend id and password:
"user": "backendusername",
"password": "backendpassword"
your device will get registered with username as "backendusername"
Basic – connects to the back end with the end user's user name and password. To use this SSO mechanism, the provider that is configured in the security profile must authenticate the end user with a user name and password, for example, System Only, HTTP/HTTPS, or LDAP.
Technical User Basic (TechUserBasic) – enter the user name and password for the technical user. You can use this SSO mechanism with any authentication-provider configuration in the security profile.
Regards,
JK
HI jitendra,
the backend which we are using is sap and the odata url is generated with netweaver gateway.
We have tried giving the SSO mechanism as basic
and the odata url in smp (backend url and authentication also)
But still we are having the 401 error.
in SMP logs we are seeing this trace:
#ERROR#Registration#401#Other#
com.sap.mobile.platform.server.online.filter.application.AbstractSMPApplicationSettingsHandler:doFilter#673#Unauthorized
#FATAL#Other#GeneratedMethodAccessor221:invoke########673###Unauthorized#
#DEBUG#Registration#Security#com.sap.mobile.platform.server.foundation.security.filter.AuthenticationFilter:doFilter#673##No AuthenticationEntryPoint was set during login attempt. Falling back to HTTP 401 + WWW-Authenticate#
##DEBUG#Registration#Security#
#com.sap.mobile.platform.server.foundation.security.filter.AuthenticationFilter:doFilter########673###authfilter-1: Security Configuration set to: 'NHttp'#
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.