Gaz Smith
Gaz Smith

Reputation: 1108

Angular $http GET pass authorization

Is it possible to pass a user and password to basic auth in AngularJS? I am using a $http to make the request :

  var urlsave = myurl;    
  $http({method: 'GET', url: urlsave}).success(function(data) {
      console.log(data);
  })

This is the response :

Status Code:401 Unauthorized

I don't have access to the back end but there is no CORS, i just need to pass it my username and password

Upvotes: 2

Views: 202

Answers (1)

Dinesh undefined
Dinesh undefined

Reputation: 5546

Yes you can pass username and password if you know username and password.

for example : http://username:[email protected]/api/something

Upvotes: 1

Related Questions