0

I am builsing my application with angularjs and in my application I am calling a rest api where I need to pass user name and password as a user credential, I am making both get and post operation using $http. Now where I will give my user credential details when calling the webservice.Please suggest some example and usefull links.

Thanks and Regards

Utpal

1 Answer 1

1

One way, as described here ng.$http , could be:

$http.get(url, { withCredentials: true, });

An extract:

withCredentials - {boolean} - whether to to set the withCredentials flag on the XHR object. See requests with credentials for more information.

Sign up to request clarification or add additional context in comments.

4 Comments

But how can I set the credentials when sending the request.Will I need to append it in URL or there is any other way. What will be the option in the case of POST operation.
get, post, put all operations are the same. In this case, without doing anything else, we are passing by the windows credentials for example (no custom authentication). If you need custom authentications... search for it. This setting will properly append credentials to all your requests
Hi thank u all for your responses but can anyone give me a sample example or link.
I am mostly using windows, but why not start here stackoverflow.com/questions/16139660 and then frederiknakstad.com/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.