cancel
Showing results for 
Search instead for 
Did you mean: 

How to use service layer in angular application

former_member275826
Participant
0 Kudos

Hi All,

I have created angular application. I am trying to connect to service layer

Service Layer Connection Code:

  ServiceLayer_Login=(): Observable<any> =>
    {
        let jData = JSON.stringify({
                    CompanyDB: this.database,
                    UserName: this.username,
                    Password: this.password
                });
        let url=this.actionUrl+'/Login';
        // let headers = new HttpHeaders({
        //     'Content-Type': 'application/json'
        //     });
        let options = {
           // headers: headers,
            withCredentials: true
            }
            return  this._http.post(url,jData,options); 
    }

Now I am trying to get items data:

Items_DropDownValues = (): Observable<any> => 
    {         
        let url=this.actionUrl+'/Items';
        return this._http.get(url,{withCredentials:true});
    }

But following popup will gets open, even i have called service layer first

If i entered credentials manually then it will work properly

I dont understand where i am wrong?

Please help me out

tomersha717
Explorer
0 Kudos

Pravin hi,

Did you find a solution since then?

I'm struggling now how to log in properly and send get request for items

via angular

Thanks, Tomer.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member275826
Participant
0 Kudos

Thanks for your reply.

Yes item request has both cookies.

But i don't have any idea how to set cookie in subsequent request in Angular project

Do you have any code snippet.

It will great help for me

Thanks

PierreBrothier
Contributor
0 Kudos

Hi,

if you have a correct sessionId after calling login request, you should set the cookie for subsequent requests.

could you check that your item request has the two cookies B1SESSION and ROUTEID in the header ?