Announcement

Collapse
No announcement yet.

Still fighting with HTTP_AUTH

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Still fighting with HTTP_AUTH

    Hello,
    I know it is not good etiquette to open a new thread about an old problem, where a thread already exists. But unfortunately I did not either solve the problem, neither get answers or proposals on how to resolve nor by a normal post nor by a personal message.
    I installed ESPO CRM for a client, because the script had all necessary for us in a smooth way and as long as I was developing the individual adaptions (only custom fields) for that client on localhost (WAMP), everything ran fine and as desired.
    After transferring the data to a webserver (I tried three different hosters), the script will not work. It seems not to be possible to let ESPO write anything in the files, where it should write something (avatars, uploads of images or documents, even logfiles are not created). I configured everything as mentioned in the documentation as well as after some hints here in the forum.
    On the server ESPO does not even show anymore already uploaded data, that I transferred, when uploading to the webserver.

    As I am not able to create logfiles, I attach here a screenshot made out of the browser development tool of Chrome.
    Click image for larger version

Name:	espo_errors.jpg
Views:	359
Size:	79.8 KB
ID:	11153


    My htaccess-file in the api/v1 folder:

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Some hosts may require you to use the `RewriteBase` directive.
    # If you need to use the `RewriteBase` directive, it should be the
    # absolute physical path to the directory that contains this htaccess file.
    #
    
    RewriteBase /api/v1/
    
    RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
    
    
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [QSA,L]
    </IfModule>
    I don`t know if that all helps to find the error. I have to add the fact, that the provider, where I try to get it to work uses the variable REDIRECT_HTTP_AUTHORIZATION instead of HTTP_AUTHORIZATION.
    I already tried every possible solution and would really appreciate any help to solve this problem. If I cannot solve it, I will have to desist from ESPO and will have a lot of extra work.

    Thank you in advance.
    Last edited by shalmaxb; 02-02-2016, 03:09 PM.

  • #2
    Hi,
    Have you tried this tool for chome.
    Play around with this tool.

    You can find the documentation here https://github.com/espocrm/documenta...lopment/api.md


    The web developers helper program to create and test custom HTTP requests.

    Comment


    • #3
      Thank you for the tip. I installed that, but to be honest, I do not see any hint in this app, that could guide me. I have to admit, that my knowledge about Apache and JSON is quite limited.

      Comment


      • #4
        try serch you for RESTFUL webservices. That helped me.. :-)
        Try make a clean install with softacolus i cpanel. Remember to remove any .thaccess in the parent folder from your ESPO

        Comment


        • #5
          Still no success. When I try to call the api, even in Advanced Rest Client appears the modal dialogue of the http-authorization. I think, that nothing is saved or handed over in ESPO, no username, no pass and no data, because I do not have access nor be able to upload documents, images, avatars etc.. I don`t no why.
          I am really not a programmer, I am a user and normally a script should not necessarily cause problems like this. If it is not possible to install it on shared hoster, would be nice to mention it in the documentation, that an own server is required.
          Thank you for trying to help me, but these things are beyond my knowledge.

          Comment


          • #6
            Please let me know the following information:
            - What OS are using on your server (Ubuntu, CentOS).
            - What PHP version? fcgi, fastcgi?
            Job Offers and Requests

            Comment


            • #7
              In the link I send my php_info. If convenient, I can give you access, because the installation has no data yet besides test-data.
              ​www.halbscheffel.eu/phpinfo_espo.html

              Comment


              • #8
                Follow this to verify your REST api work.
                1. Go to https://www.base64encode.org -> Select 'Encode'
                2. Type USERNAME:PASSWORD -> press > ENCODE <
                3. CTRL+C (copy) the Base64 string
                4. Start your Advanced Rest Client
                5. Enter the URL: "http://YOURDOMAIN/api/v1/App/user
                6. Enter Header -> name: Espo-Authorization, value: CTRL+V (insert the base64 string)
                7. Press >SEND<
                this work for me... :-)

                Comment


                • #9
                  Hello, thank you again very much for your effort to help me.
                  I made as suggested and in Advanced Rest Client with the GET function it shows my (so far) two registered users. So far, this seems to be ok and shows the Rest API working.
                  When I try other functions as POST or PUT it does not resolve anything.

                  And it does not take me further in my problem, because always, when I try to call a page, that needs authorization, the browser dialogue prompts and I won`t get further. Somehow the Base64 Code isn`t handed over to Espo. As I am also not able to upload anything or even be able to see, what had been uploaded during developing on local server, I guess it has something to do with file saving.
                  The first thing I did concerning this, was, that I changed the permissions to the folders on the server, but without success either.

                  Comment


                  • #10
                    I got to have the Espo-Authorization with the base64 hash (ie Espo-Authorization: sdfsdfedfsdfkxcvnhysj) in the header for all the request.
                    All request needs Espo-Authorization. If the Authorization is not accepted by ESPO, your Advanced Rest Client will promt for user and password.

                    Comment


                    • #11
                      Well, then why is it accepted for GET but for nothing else? By what could that be caused? As I told, is was everything ok on local server, only in shared hosting environment it won`t work.

                      Comment


                      • #12
                        oohh, okay... :-)
                        could the problem maybe be related til this.
                         

                        Comment


                        • #13
                          Still no solution....
                          Could one of the programmers give a hint?
                          Thank You

                          Comment


                          • #14
                            If you have a shared hosting, please contact your support to enable HTTP Authorization for FastCGI. It should be done by changing a configuration file:
                            Code:
                            <IfModule mod_fcgid.c>
                              FcgidPassHeader Authorization
                              FcgidPassHeader Proxy-Authorization
                              FcgidPassHeader HTTP_AUTHORIZATION
                            </IfModule>
                            Or
                            Code:
                            <IfModule mod_fastcgi.c>
                               FastCgiConfig -pass-header Authorization -pass-header Proxy-Authorization -pass-header HTTP_AUTHORIZATION  
                            </IfModule>
                            Job Offers and Requests

                            Comment


                            • #15
                              Thank you, I will try that, although my provider told me, that their module is called REDIRECT_HTTP_AUTHORIZATION and is activated.

                              Meanwhile Espo created a new logfile as from 4th of february (don`t know, why suddenly creating again, because before did not creat from december to now). It was the day when I made the REST Api testing as dafnie suggested. This is the content of the log file:

                              Code:
                              [2016-02-04 10:02:07] Espo.ERROR: E_RECOVERABLE_ERROR: Argument 2 passed to Espo\Services\Record::beforeCreate() must be of the type array, string given, called in /homepages/1/xxxxxxx/htdocs/xxxxxxx.de/application/Espo/Services/Record.php on line 428 and defined {"file":"/homepages/1/xxxxxxx/htdocs/xxxxxxx.de/application/Espo/Services/Record.php","line":497} []
                              [2016-02-04 10:02:07] Espo.ERROR: API [POST]:/:controller, Params:Array
                              (
                                  [controller] => user
                              )
                              , InputData:  -  [] []
                              [2016-02-04 10:02:07] Espo.ERROR: Display Error: , Code: 500 URL: /api/v1/user [] []
                              [2016-02-04 10:06:07] Espo.ERROR: E_RECOVERABLE_ERROR: Argument 2 passed to Espo\Services\Record::beforeCreate() must be of the type array, string given, called in /homepages/1/xxxxxxx/htdocs/xxxxxxx.de/application/Espo/Services/Record.php on line 428 and defined {"file":"/homepages/1/d11xxxxxxx/htdocs/xxxxxxxx.de/application/Espo/Services/Record.php","line":497} []
                              [2016-02-04 10:06:07] Espo.ERROR: API [POST]:/:controller, Params:Array
                              (
                                  [controller] => user
                              )
                              , InputData:  -  [] []
                              [2016-02-04 10:06:07] Espo.ERROR: Display Error: , Code: 500 URL: /api/v1/user [] []

                              Comment

                              Working...
                              X