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

FIWARE.Request.Tech.Security.IDM-KeyRock.Authentication in Python

    Details

      Description

      Created question in FIWARE Q/A platform on 20-03-2015 at 11:03
      Please, ANSWER this question AT http://stackoverflow.com/questions/29164371/fiware-oauth2-authentication-in-python

      Question:
      FIWARE OAuth2 Authentication in Python

      Description:
      I am trying to authenticate user using FIWARE.

      It returns a 404. Thus fails at Step 1 itself. What is the access token url ? Any other pointers to check

      I have tried variations with 'oauth/access_token', 'oauth/token' 'oauth2/token' 'oauth2/access_token' . All of them dont seem to work.

      My Code is Below:

      import oauth2 as oauth

      1. OAuth secret into your project's settings.
        consumer = oauth2.Consumer(settings.FIWARE_CLIENT_ID,settings.FIWARE_CLIENT_SECRET)
        client = oauth2.Client(consumer)

      access_token_url = 'https://account.lab.fiware.org/oauth2/access_token'

      1. This is the slightly different URL used to authenticate/authorize.
        authenticate_url = 'https://account.lab.fiware.org/oauth2/authorize'

      def fiware_login(request):

      1. Step 1. Get a request token from FIWARE.
        resp, content = client.request(access_token_url, "GET")
        print resp
        if resp['status'] != '200':
        print content
        raise Exception("Invalid response from FIWARE.")
      1. Step 2. Redirect the user to the authentication URL.
        url = "%s?access_token=%s" % (authenticate_url,
        resp['access_token'])

      return HttpResponseRedirect(url)

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2015-10-14 18:05|CREATED monitor | # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2015-10-14 18:05|CREATED monitor | # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2015-10-14 21:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2015-10-14 21:05|UPDATED status: transition Answer| # answers= 1, accepted answer= True
        Hide
        backlogmanager Backlog Manager added a comment -

        2015-10-15 00:05|UPDATED status: transition Answered| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2015-10-15 00:05|UPDATED status: transition Answered| # answers= 1, accepted answer= True

          People

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

            Dates

            • Created:
              Updated:
              Resolved: