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

FIWARE.Request.Tech.Data.BigData-Analysis.401EvenWithAuthToken

    Details

    • Type: extRequest
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Fix Version/s: 2021
    • Component/s: FIWARE-TECH-HELP
    • Labels:
      None
    • HD-Chapter:
      Data
    • HD-Enabler:
      Cosmos

      Description

      Hi, please find hereafter a snipped python code to use OAuth2 on Cosmos,
      but the services always replies 401, even if token is used.

      Username and password for getting the token is the ones of a FIWARE LAB
      user.

      May you help us?

      Thanks in advance for your help,
      P.

      ------------------------------------
      import requests

      def get_oauth_token():

      OAUTH_SERVER = "https://130.206.80.46:13000/cosmos-auth/v1/token"
      OAUTH_CONTENT = "grant_type=password&username=XXX&password=XXX"

      req_headers =

      {'Content-Type': 'application/x-www-form-urlencoded'}

      r = requests.post(OAUTH_SERVER, data=OAUTH_CONTENT,
      headers=req_headers, verify=False)
      res = r.json()
      return res['access_token']

      if _name_ == "_main_":

      headers = None

      t = get_oauth_token()

      if not headers:
      headers = {}

      headers['X-Auth-Token'] = t
      print headers

      TEST_GET = "http://130.206.80.46:14000/webhdfs/v1/user/XXXXXX.txt"
      TEST_GET_PARAMS = "op=getfilestatus&user.name=XXXX"
      response = requests.get(TEST_GET, data=TEST_GET_PARAMS,
      headers=headers)
      print response
      --------------

      Pasquale Andriani
      Direzione Ricerca e Innovazione - Research & Development Lab
      pasquale.andriani@eng.it

      Engineering Ingegneria Informatica spa
      Via Riccardo Morandi, 32 - 00148 Roma
      Tel. +39-06.87594138
      Mob. +39 3924698746
      Fax. +39-06.83074408
      www.eng.it

      _______________________________________________
      Fiware-lab-help mailing list
      Fiware-lab-help@lists.fi-ware.org
      https://lists.fi-ware.org/listinfo/fiware-lab-help

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        mev Manuel Escriche made changes -
        HD-Enabler Cosmos [ 10872 ]
        HD-Chapter Data [ 10838 ]
        mev Manuel Escriche made changes -
        Summary FIWARE.Request.Lab.Data.BigData-Analysis.401EvenWithAuthToken FIWARE.Request.Tech.Data.BigData-Analysis.401EvenWithAuthToken
        frb Francisco Romero made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        frb Francisco Romero made changes -
        Summary FIWARE.Request.Lab.Data.BigData-Analysis. FIWARE.Request.Lab.Data.BigData-Analysis.401EvenWithAuthToken
        frb Francisco Romero made changes -
        Summary [Fiware-lab-help] OAuth2 authentication on COSMOS - token returned but next request replies 401 FIWARE.Request.Lab.Data.BigData-Analysis.
        frb Francisco Romero made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        frb Francisco Romero made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        alfopietro Pietropaolo Alfonso made changes -
        Assignee Francisco Romero [ frb ]
        alfopietro Pietropaolo Alfonso made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        pandriani Pasquale Andriani created issue -

          People

          • Assignee:
            frb Francisco Romero
            Reporter:
            pandriani Pasquale Andriani
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: