Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

MMHttp.getText() with basic authentication

Guest
Nov 19, 2011 Nov 19, 2011

Hi All,

I am creating a Dreamweaver Extension that pulls data from a website. I use MMHttp.getText() to retrieve a URL and the website uses basic authentication.

How do I specify username and password for MMHttp.getText() method?

I have tried using https://username:password@www.... type URL but still does not work.

Thank you.

Regards,

Nugroho

TOPICS
Extensions
4.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 21, 2011 Nov 21, 2011

The MMHttp object is very basic, if changing the URL didn't work (assuming it does work as expected when you try that same URL in a browser), then that type of authenticaion is likely not supported. Does it work with the HTTP (as in not HTTPS)? I believe that HTTPS support was added a couple of versions ago, so it's possible there are some limitations along that line.

Danilo Celic

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2011 Nov 21, 2011

I have tried the URL (that contains username and passowrd) in a browser and it works but it does not work using MMHttp.

Regarding HTTPS support, I tested using MMHttp to non-authenticated HTTPS  website and its works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 21, 2011 Nov 21, 2011

If HTTPS is supported on your site, then it looks like you should pass the user name and password in via the query string of the URL you're using and check the values on the server to allow returning of the content, or maybe think about using MHttp.postText() instead to pass the user name and password as posted values, that way the values aren't in the URL itself. Based on what I've read, the query string values aren't readable by thrid parties.

Danilo Celic

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2011 Nov 21, 2011

Thank you for your suggestion but passing username and password in query string would not work for Basic authentication.

For Basic Auth, username and password  should be passed using HTTP headers and it seems the getText() method does not support setting HTTP headers.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 21, 2011 Nov 21, 2011

Yes I know, that's why I said in my response to check the values on the server. You can do a look up either in a DB or from some settings file.

Danilo Celic

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 21, 2011 Nov 21, 2011

The problem is I don't have control over the server code. The website provides REST API with Basic Authentication.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 22, 2011 Nov 22, 2011

Which version of Dreamweaver are you working on, and which platform? I corresponded with a Dreamweaver engineer and they stated that it should be able to connect with basic authentication turned on for Windows versions of Dreamweaver, but probably not work at all on Mac. I set up my IIS7 on Windows 7 and set a folder on my localhost that was set to basic authentication and when I tried it the username and password dialog would appear. This would happen only the first time you access the authenticated URL in a Dreamweaver session; that is, once you close and restart Dreamweaver, and tried the URL again, the prompt would appear again. I tried this with and without the username and password in the URL and it always popped up a prompt dialog.

One suggestion might be to try conntecting to the authenticated page via an XHR object within a mm:browsercontrol:

http://help.adobe.com/en_US/dreamweaver/cs/extend/WS3825E1AD-223E-47e9-B86B-ECFBCC45BE0C.html

Search the Dreamweaver application configuration for examples of using the mm:browsercontrol, I beleive that the Spry Dataset Wizard uses that control.

Danilo Celic

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Nov 22, 2011 Nov 22, 2011

I use Dreamweaver CS5.5 on Mac OSX. I think that would be the problem. I will try to use mm:browsercontrol.

Thank you for your help.

Nugroho

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 03, 2015 Jul 03, 2015
LATEST

Hello Danilo,

   I want to use mm:browsercontrol in Dreamweaver CC 2015 to call a remote web service using XHR/XMLHTTPRequest object. However, I do not know how to achieve this exactly. I browsed the Adobe help for mm:browsercontrol at : Adobe Dreamweaver CS5 & CS5.5 * <mm:browsercontrol> but could not find any clue of how to actually achieve this. Can you share some working sample example or guide me to any forums/sites that can help me?

Thanks a lot in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines