Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-9006

[fiware-stackoverflow] FIWARE Wirecloud: Error using X-FI-WARE-OAuth-Token request header

    Details

      Description

      Created question in FIWARE Q/A platform on 01-05-2016 at 01:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/36961272/fiware-wirecloud-error-using-x-fi-ware-oauth-token-request-header

      Question:
      FIWARE Wirecloud: Error using X-FI-WARE-OAuth-Token request header

      Description:
      We are part of the FINISH accelerator and are deploying Wirecloud and KeyRock on our own servers using the docker containers provided by fiware.

      We have KeyRock-IdM set up and linked to Wirecloud. We are trying to pass the logged-in users token to an API which returns data to a widget.

      We found documentation about the "X-FI-WARE..." headers in the github code and wrote a test widget (main.js shown below). When deployed on the fiware labs instance, it works out of the box. When deployed on our local installation with a docker container it gives the following error: "Current user has not an active FIWARE profile". I scoured the settings.py file but have no idea where this error is coming from. I have DEBUG=True but nothing show up in the log. The user running the widget was logged in through the KeyRock IdM.

      /*jshint globalstrict:true */
      /global MashupPlatform, ObjectStorageAPI, StyledElements/

      (function () {

      "use strict";

      var token_available = MashupPlatform.context.get('fiware_token_available');
      var username = MashupPlatform.context.get('username');
      alert(username + " has token?: " + token_available);

      var url = MashupPlatform.prefs.get('keyRock_url');

      var request = MashupPlatform.http.makeRequest(url, {
      requestHeaders:

      { "X-FI-WARE-OAuth-Token": "true", "X-FI-WARE-OAuth-GET-Parameter": "access_token" }

      ,
      method: "GET",
      onSuccess: function (response)

      { alert("Success:" + JSON.stringify(response.responseText)); document.getElementById('response').textContent = response.responseText; }

      ,
      onFailure: function (response)

      { alert("Failed:" + JSON.stringify(response.responseText)); }

      ,
      onComplete: function () {
      }
      }
      );

      })();

      How can i find out what is going wrong?

      From the comment below, changed a python script:
      edited the /usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py file in the docker container and replaced line 37 from raise ValidationError(error_msg) to a simple raise.

      the log from /var/log/apache2/error.log is below

      [Fri May 06 07:12:33.745550 2016] [wsgi:error] [pid 13:tid 139955375367936] Internal Server Error: /cdp/https/account.lab.fiware.org/user
      [Fri May 06 07:12:33.745580 2016] [wsgi:error] [pid 13:tid 139955375367936] Traceback (most recent call last):
      [Fri May 06 07:12:33.745584 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/proxy/views.py", line 234, in proxy_request
      [Fri May 06 07:12:33.745587 2016] [wsgi:error] [pid 13:tid 139955375367936] response = WIRECLOUD_PROXY.do_request(request, url, request_method, workspace)
      [Fri May 06 07:12:33.745589 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/proxy/views.py", line 144, in do_request
      [Fri May 06 07:12:33.745592 2016] [wsgi:error] [pid 13:tid 139955375367936] processor.process_request(request_data)
      [Fri May 06 07:12:33.745594 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py", line 59, in process_request
      [Fri May 06 07:12:33.745597 2016] [wsgi:error] [pid 13:tid 139955375367936] token = get_access_token(request['user'], _('Current user has not an active FIWARE profile'))
      [Fri May 06 07:12:33.745599 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py", line 33, in get_access_token
      [Fri May 06 07:12:33.745602 2016] [wsgi:error] [pid 13:tid 139955375367936] if oauth_info.access_token is None:
      [Fri May 06 07:12:33.745604 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/social/storage/base.py", line 41, in access_token
      [Fri May 06 07:12:33.745615 2016] [wsgi:error] [pid 13:tid 139955375367936] return self.extra_data.get('access_token')
      [Fri May 06 07:12:33.745618 2016] [wsgi:error] [pid 13:tid 139955375367936] AttributeError: 'unicode' object has no attribute 'get'

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 15:15|CREATED monitor | # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 15:15|CREATED monitor | # answers= 3, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 18:10|UPDATED status: transition Answer| # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 18:10|UPDATED status: transition Answer| # answers= 3, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2017-05-22 21:10|UPDATED status: transition Finish| # answers= 3, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2017-05-22 21:10|UPDATED status: transition Finish| # answers= 3, accepted answer= True

          People

          • Assignee:
            backlogmanager Backlog Manager
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: