cancel
Showing results for 
Search instead for 
Did you mean: 

xsodata service redirecting to sap account page.

Former Member
0 Kudos

Hello All,

whenever i m trying to access .xsodata service, its redirecting to sap account page.

instead of this is it possible to take username and password from popup, and then it will display data directly.

i don't want to redirect to sap account page again n again.

and yes i don't want to remove the authentication part from odata service.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Is this on the HANA Cloud Platform? If so they set the OAuth authorization to be the default at the system level.  Have you tried changing the values of the XSACCESS file for this package and changing the authentication to just Form or Basic?

Former Member
0 Kudos

yes we tried. and we are using trial version of hana

and this is my code for .xsaccess file

{
  "exposed": true,
  "authentication" : [{"method":"Basic"}]
}

we also tried with [{"method":"Form"}]. in both case its redirecting to sap account page. 

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Have you tried setting it from the XSAdmin tool?  Is this .xsaccess file in the specific folder of your xsodata?  You might be hitting something specific to the security setup of the HCP trial landscape that it only allows OAuth.  These settings would work on a non-HCP HANA system.

Former Member
0 Kudos

we are new in Hana.

can u help us how to access XSAdmin tool. ??

yes .xsaccess and .xsodata files are in the project folder only. not in specific folder.

we haven't done anything in security setup of HCP.



we want to consume authorized odata service( using .xsodata) in sap ui5. can u help us to implement this.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>can u help us how to access XSAdmin tool.

The http path is /sap/hana/xs/admin

>we haven't done anything in security setup of HCP.

Nor would you be able to since you are using the trial system which is multi-tenant. All system configuration is already set for you.

>we want to consume authorized odata service( using .xsodata) in sap ui5. can u help us to implement this.

Are you running the UI5 application from the same HANA system? If so when you authorize the web page, you won't need to do anything extra to call the service.  The same authentication will automatically be used.

Former Member
0 Kudos

Hi Thomas,

Yes we are running the UI5 application and HANA from the same system,

When we try to get the odata services with basic auth , it is redirecting to the sap login page (HTML) even if we are logged in a different tab to the scn account

we are calling like this

var oModel2 = new sap.ui.model.odata.ODataModel("proxy/https/s3hanaxs.hanatrial.ondemand.com/pxxxxxxxxtrial/dev/test/projects.xsodata/LISTS", false, "username" , "password"

and in the console we get the error

The following problem occurred: Invalid metadata document200,OK, <!DOCTYPE html><html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />


and the full html page




Also in the trial instance how will the path of xsadmin be?

the application path is

https://s3hanaxs.hanatrial.ondemand.com/pxxxxxtrial/dev/test/



thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If the XSODATA service and the UI5 are coming from the same HANA system then you shouldn't use an absolute URL or the proxy to call it. Just use a relative URL like so: /pxxxxxxxxtrial/dev/test/projects.xsodata/LISTS

>

Also in the trial instance how will the path of xsadmin be?

the application path is

https://s3hanaxs.hanatrial.ondemand.com/pxxxxxtrial/dev/test/

no I don't believe so.  /pxxxxxxxxtrial/dev/test/ is where your content is running from. However XSADMIN and Web IDE are tools installed centrally and not specific your development part of the repository. 

Former Member
0 Kudos

Thank you,

but when i try publishing the ui5 app from eclipse, it is deployed in a url

https://testp1xxxrial.hanatrial.ondemand.com/pxxxxxxtrial


while my xs app is at

https://s3hanaxs.hanatrial.ondemand.com/pxxxxxtrial/dev/test/


so UI5 app gives a 404 error

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Publishing from Eclipse?  What exactly are you doing?  There is no publish that works with HANA. You save and activate. You can then run the application with the Run As dialog. it should generate the URL correctly for you.

Former Member
0 Kudos

By publishing i meant the run,

So how i did is

First activate the app

Selected Run As > Run on Server

Select the checkbox Manually define a new server > SAP HANA Cloud Platform

Then entered the app name and account information

And it runs the app in the url

https://testp1xxxrial.hanatrial.ondemand.com/pxxxxxxtrial


where test is the app name i entered

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You should choose Run As -> HTML.  You shouldn't need to create a Configuration. Everything will be pulled from your system connection information.

Former Member
0 Kudos

Thank you, i was doing  it wrong, i was trying Run as on the project instead of the file.

But now when i try to run the index.html as html  i am getting a 404 error

the url generated is

s3hanaxs.hanatrial.ondemand.com/pxxxxxxtrial/dev/ui5test/WebContent/index.html

And in the hana cockpit, my xs apps are listed but in HTML5 tab, my UI5 apps are not listed ,

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Is that the correct URL for your application? 

>And in the hana cockpit, my xs apps are listed but in HTML5 tab, my UI5 apps are not listed ,

I couldn't comment on this cockpit as it is purely HCP specific and doesn't come from HANA.

Former Member
0 Kudos

Yes the url is correct

my xs app works

https://s3hanaxs.hanatrial.ondemand.com/pxxxxxtrial/dev/test

here

and the ui5 is https://s3hanaxs.hanatrial.ondemand.com/pxxxxxxtrial/dev/ui5test/WebContent/index.html

here

but when i run in my local host the url is only

localhost:8873/testUI5/

and shows the app

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I'm sorry but from your last response I'm confused as to what is working and what isn't.

Former Member
0 Kudos

test

Former Member
0 Kudos

oops sorry bringing the confusion,

The XS app is working , it has the xsodata which i can access with a rest client and get the data.

which can be accessed from this url

https://s3hanaxs.hanatrial.ondemand.com/pxxxxxtrial/dev/test/projects.xsodata/LISTS



The problem is with the UI5 app

which i try to Run as HTML , it runs at this link

s3hanaxs.hanatrial.ondemand.com/pxxxxxxtrial/dev/ui5test/WebContent/index.html

and i am getting 404 error


thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

So do you have an .xsapp and .xsaccess file at the dev package level or is it in /dev/test/?  If the later then you need one of each as well in /dev/ui5test/

Former Member
0 Kudos

I had the xsaccess and xsapp files in the  /dev/test, so i added the same in /dev/ui5test

so my xsaccess file is now like this

{

  "exposed" : true,

    "authentication" : [{"method":"Basic"}],

  "cors" : {"enabled" : true}

}

Now when i run the index.html file its coming but now a new error, it says

https://s3hanaxs.hanatrial.ondemand.com/resources/sap-ui-core.js

is 404

In the sap ui5 app index.html its

<script src="/resources/sap-ui-core.js"

  id="sap-ui-bootstrap"

  data-sap-ui-libs="sap.ui.ux3,sap.ui.commons,sap.ui.table"

  data-sap-ui-theme="sap_goldreflection">

  </script>

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That's because your script source is wrong. Instead of:


src="/resources/sap-ui-core.js"


It should be:


src="/sap/ui5/1/resources/sap-ui-core.js"

Former Member
0 Kudos

Thanks a lot, it fixed that problem

Now i have one more, hope it would be the last

The odata url i am giving is

/pxxxxxtrial/dev/test/projects.xsodata/LISTS

But when i check the browser console its showing that its calling

/pxxxxxtrial/dev/test/projects.xsodata/LISTS/$metadata

and that /$metadata is causing a 400 bad request

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Don't put the entity name (LISTS) as part of the URL in the OData Model.

Former Member
0 Kudos

IT worked, now i am able to get the OData in the UI5 thanks a lot Thomas

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, i am having one more issue now

So the previous case UI app and XS app was on the same system and it worked

Now i am creating a html phonegap app which should receive data from the xsodata and display

So i am facing the same authentication and redirection  issue

How can i solve this?

Former Member
0 Kudos

I have the same issue. I can't access my odata service from other systems.

Karthik-Thiru
Product and Topic Expert
Product and Topic Expert
0 Kudos

I am facing the same issue. I have created a UI5 app in HCP ( Hana trial account ) and trying to consume xsodata. In the Chrome console i see that when the UI5 app tries to fetch the $metadata it gets redirected to 'https://account.sap.com/......." with an error message  -  ' which is disallowed for cross-origin requests that require preflight'.

Has anyone of you got a solution for this ?