0

In my Angular 2 app, I'm using the http service to make a GET call to my website. That site is locked down via certificate funkiness. If I were making the GET call via curl I'd pass in the --cert flag and specify my .pem file to make the connection.

How do I do that same thing with this http.get call?

Gargoyle
  • 9,590
  • 16
  • 80
  • 145
  • It's not clear what exactly is your case, but you can't do anything like that. It doesn't matter if you use Angular or not. This is how JS works. The browser takes care of all the certificates. If you can't make a request to HTTPS site, you likely have a CORS problem. – Estus Flask Apr 02 '17 at 23:53
  • No, it's not CORS. It's just SSL stuff. I disabled all that and made it so I just pass a basic auth username/password now. All the Angular 2 examples I see for this are for POST though. I'm trying to do a GET. Can you show an example of how that works please? – Gargoyle Apr 03 '17 at 00:24
  • You don't need any special actions for SSL. Again, this is handled by browser, scripts don't (and can't) deal with certificates. You just do a request to URL. If it is not cross-origin request, it will be performed. It's absolutely the same for GET as for POST. Read the manual, https://angular.io/docs/ts/latest/guide/server-communication.html#!#fetch-data – Estus Flask Apr 03 '17 at 00:55
  • All I'm asking at this point is how to set the user/pwd on the GET request. I don't see that in the docs, that's why I'm asking for help. – Gargoyle Apr 03 '17 at 01:03
  • Not sure why you're asking about pem if the real question is basic auth. Possible duplicate of http://stackoverflow.com/questions/31671132/how-to-call-rest-service-with-basic-authentication-in-angularjs-2-0 – Estus Flask Apr 03 '17 at 01:17

0 Answers0