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

FIWARE.Request.Tech.Security.IDM-KeyRock.Getaccesstoken

    Details

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

      Description

      Hi,

      I'm using an android library to get the access token using explicit
      authentication.

      API: https://github.com/wuman/android-oauth-client

      This API is build on top of google API:
      https://github.com/google/google-oauth-java-client

      The authorization token is being retrieved correctly. The problem is when I
      try to exchange it for an access_token.

      Here is my request using the API:

      AuthorizationFlow flow = new AuthorizationFlow.Builder(
      //BearerToken.authorizationHeaderAccessMethod(),
      //BearerToken.queryParameterAccessMethod(),
      BearerToken.formEncodedBodyAccessMethod(),
      OAuth.HTTP_TRANSPORT,
      OAuth.JSON_FACTORY,
      new GenericUrl(LoginConstants.TOKEN_SERVER_URL),
      new BasicAuthentication(LoginConstants.CLIENT_ID,
      LoginConstants.CLIENT_SECRET),
      LoginConstants.CLIENT_ID,
      LoginConstants.AUTHORIZATION_CODE_SERVER_URL)
      .setScopes(Lists.<String> newArrayList())
      .setCredentialStore(credentialStore)
      .build();

      DocString:
      /**

      • @param method method of presenting the access token to the resource
      • server (for example
      • {@link BearerToken#authorizationHeaderAccessMethod}

        )

      • @param transport HTTP transport
      • @param jsonFactory JSON factory
      • @param tokenServerUrl token server URL
      • @param clientAuthentication client authentication or {@code null}

        for

      • none (see
      • {@link TokenRequest#setClientAuthentication(HttpExecuteInterceptor)}
      • )
      • @param clientId client identifier
      • @param authorizationServerEncodedUrl authorization server encoded URL
        */
        public Builder(AccessMethod method,
        HttpTransport transport,
        JsonFactory jsonFactory,
        GenericUrl tokenServerUrl,
        HttpExecuteInterceptor clientAuthentication,
        String clientId,
        String authorizationServerEncodedUrl)

      I've been able to Intercept the Request and Response, and this is the
      result:

      Request:

      *Request getUrl: *https://account.lab.fiware.org/oauth2/token
      Request getRequestMethod: POST
      Request getHeaders:

      {accept=[application/json], accept-encoding=[gzip], authorization=[Basic MzNkYTk0NzFjZWQyNGFmMDk1ZDhiMDg0OWY1YTY0YmE6Yjc4M2Q5NmIwMzIxNGMxOWJmYjEyMzI5OGNjZDA2ZmM=]}

      Request getContent:
      code=QqU5dSHksT13hyb5yUMqZLGpge5S1f&grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%2FCallback&scope
      Request getTransport:
      com.google.api.client.http.javanet.NetHttpTransport@1182878e
      Request getResponseHeaders:

      {content-type=[application/json], date=[Fri, 03 Jul 2015 09:27:16 GMT], connection=[close], content-language=[en], server=[Apache/2.4.7 (Ubuntu)], transfer-encoding=[chunked], vary=[Accept-Language,Cookie], x-android-received-millis=[1435915582841], x-android-response-source=[NETWORK 400], x-android-sent-millis=[1435915582737], x-frame-options=[SAMEORIGIN]}

      Response:

      *Response getStatusCode: *400
      Response getStatusMessage: Bad Request
      Response getHeaders:

      {content-type=[application/json], date=[Fri, 03 Jul 2015 09:27:16 GMT], connection=[close], content-language=[en], server=[Apache/2.4.7 (Ubuntu)], transfer-encoding=[chunked], vary=[Accept-Language,Cookie], x-android-received-millis=[1435915582841], x-android-response-source=[NETWORK 400], x-android-sent-millis=[1435915582737], x-frame-options=[SAMEORIGIN]}

      Response getMediaType: application/json
      Response getTransport:
      com.google.api.client.http.javanet.NetHttpTransport@1182878e
      Response getContentType: application/json
      Response getContent:

      { "error" : "" }

      IMPORTANT: I AM able to get the access token by using Chrome's REST client
      with the
      SAME Request getContent given above and the *SAME **Authorization: Basic
      XXX* also given above, so they are correct.
      I've tried to had Content-Type: application/x-www-form-urlencoded to the
      request, but the error resulting was the same.
      I AM able to use this API with another Identity Management Servers, like
      foursquare.

      Having no information on the error response and sending exactly what you
      define in:

      https://github.com/ging/fi-ware-idm/wiki/Using-the-FIWARE-LAB-instance

      It Becomes hard to solve it from my side. I've tried giving you every
      information I have, but If you require more, please ask.

      [image: Inline image 1]

      Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A.
      Headquarters

      *Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos
      VinhosPortugalT: +351 263 978 572*
      Lisbon Office
      Av. 5 de Outubro, 70 - 8º
      1050-059 Lisboa
      Portugal
      T: +351 211 956 542
      T: +351 211 956 546
      F: +351 211 956 531

      W: www.plux.info

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

      [Created via e-mail received from: =?UTF-8?Q?Pedro_Gon=C3=A7alves?= <pgoncalves@plux.info>]

      1. image.png
        5 kB
      2. image.png
        5 kB
      3. image.png
        5 kB
      4. image.png
        5 kB
      5. REST.JPG
        113 kB

        Activity

        Hide
        fw.ext.user FW External User added a comment -

        In attachment you'll find a printscreen of the request made by Google REST
        Advanced Client.

        With URL *copied from *Request getUrl
        Authorization *Header copied from *Request getHeaders[authorization]
        and Payload copied from Request getContent

        On Fri, Jul 3, 2015 at 10:39 AM, Pedro Gonçalves <pgoncalves@plux.info>

        [image: Inline image 1]

        Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A.
        Headquarters

        *Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos
        VinhosPortugalT: +351 263 978 572*
        Lisbon Office
        Av. 5 de Outubro, 70 - 8º
        1050-059 Lisboa
        Portugal
        T: +351 211 956 542
        T: +351 211 956 546
        F: +351 211 956 531

        W: www.plux.info

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

        Show
        fw.ext.user FW External User added a comment - In attachment you'll find a printscreen of the request made by Google REST Advanced Client. With URL *copied from *Request getUrl Authorization *Header copied from *Request getHeaders [authorization] and Payload copied from Request getContent On Fri, Jul 3, 2015 at 10:39 AM, Pedro Gonçalves <pgoncalves@plux.info> – [image: Inline image 1] Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A. Headquarters *Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos VinhosPortugalT: +351 263 978 572* Lisbon Office Av. 5 de Outubro, 70 - 8º 1050-059 Lisboa Portugal T : +351 211 956 542 T : +351 211 956 546 F : +351 211 956 531 W : www.plux.info _______________________________________________ Fiware-lab-help mailing list Fiware-lab-help@lists.fi-ware.org https://lists.fi-ware.org/listinfo/fiware-lab-help
        Hide
        fw.ext.user FW External User added a comment -

        In attachment you'll find a printscreen of the request made by Google REST
        Advanced Client.

        With URL *copied from *Request getUrl
        Authorization *Header copied from *Request getHeaders[authorization]
        and Payload copied from Request getContent

        On Fri, Jul 3, 2015 at 10:39 AM, Pedro Gonçalves <pgoncalves@plux.info>

        [image: Inline image 1]

        Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A.
        Headquarters

        *Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos
        VinhosPortugalT: +351 263 978 572*
        Lisbon Office
        Av. 5 de Outubro, 70 - 8º
        1050-059 Lisboa
        Portugal
        T: +351 211 956 542
        T: +351 211 956 546
        F: +351 211 956 531

        W: www.plux.info

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

        Show
        fw.ext.user FW External User added a comment - In attachment you'll find a printscreen of the request made by Google REST Advanced Client. With URL *copied from *Request getUrl Authorization *Header copied from *Request getHeaders [authorization] and Payload copied from Request getContent On Fri, Jul 3, 2015 at 10:39 AM, Pedro Gonçalves <pgoncalves@plux.info> – [image: Inline image 1] Pedro GonçalvesResearch Software EngineerPLUX - Wireless Biosignals, S.A. Headquarters *Zona Industrial das Corredouras, Lt. 14 - 1º2630-369 Arruda dos VinhosPortugalT: +351 263 978 572* Lisbon Office Av. 5 de Outubro, 70 - 8º 1050-059 Lisboa Portugal T : +351 211 956 542 T : +351 211 956 546 F : +351 211 956 531 W : www.plux.info _______________________________________________ Fiware-lab-help mailing list Fiware-lab-help@lists.fi-ware.org https://lists.fi-ware.org/listinfo/fiware-lab-help
        Hide
        sandor Sándor Laki added a comment -

        Dear Pedro,

        I have just forwarded your request to the developers of FIWARE IdM. They
        will contact you soon.

        Best,
        Sandor
        – on behalf of level-1 support team


        Sándor Laki
        EU FP7 FI-PPP XIFI project,
        Wigner Research Centre for Physics,
        Hungarian Academy of Sciences
        Konkoly Thege Miklós út 29-33.
        H-1121, Budapest, Hungary
        Cell: +36 70 374 2646
        Skype: sandor.laki

        XIFI: https://fi-xifi.eu/home.html
        FI-PPP: http://www.fi-ppp.eu/

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

        Show
        sandor Sándor Laki added a comment - Dear Pedro, I have just forwarded your request to the developers of FIWARE IdM. They will contact you soon. Best, Sandor – on behalf of level-1 support team – Sándor Laki EU FP7 FI-PPP XIFI project, Wigner Research Centre for Physics, Hungarian Academy of Sciences Konkoly Thege Miklós út 29-33. H-1121, Budapest, Hungary Cell: +36 70 374 2646 Skype: sandor.laki XIFI: https://fi-xifi.eu/home.html FI-PPP: http://www.fi-ppp.eu/ _______________________________________________ Fiware-lab-help mailing list Fiware-lab-help@lists.fi-ware.org https://lists.fi-ware.org/listinfo/fiware-lab-help

          People

          • Assignee:
            aalonsog Alvaro Alonso
            Reporter:
            fw.ext.user FW External User
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: