Layer7 API Management

  • 1.  Getting invalid_request while accessing oauth manager

    Posted Mar 08, 2018 03:06 AM

    Hi Friends,

    When I am accesing the oauth protected api using postman ,I am getting response as below.The same response i am getting when I am calling https://gatewayhost/auth/oauth/v2/authorize.

    I have attached the screenshots for details.

     

    {
    "error": "invalid_request",
    "error_description": "Validation error"
    }

     

     

    Please guide me where I am going wrong.



  • 2.  Re: Getting invalid_request while accessing oauth manager

    Broadcom Employee
    Posted Mar 08, 2018 07:55 AM

    Hi Sonia,

     

    I would check in OAuth manager that this token is valid (not expired or revoked) for the protected api endpoint.

     

    As for the screenshot of the authorize endpoint, this is used by the implicit and authcode grant types. Additional parameters are required for a proper response,  ie: response_type, client_id.

     

    Regards,

    Joe



  • 3.  Re: Getting invalid_request while accessing oauth manager

    Posted Mar 09, 2018 12:50 AM

    Hi Joe,

    Thank you for your reply.But even directly I am calling token service with valid client id,client secret and grant_type=client _credentials ,I am getting same reply.Please find below screenshot:-

    In screenshot i have send base 64 encoded clientid:clientsecret.

    I also trient sending all the values in header but still I am unable to get access token.



  • 4.  Re: Getting invalid_request while accessing oauth manager
    Best Answer

    Broadcom Employee
    Posted Mar 09, 2018 08:21 AM

    Hi Sonia,

     

    You need to use an HTTP POST here for the token endpoint:

     

     

    Reference:

    grant_type=client_credentials 

    This grant_type can be used if the client is acting on its own behalf. No user consent is required.

    Request
    Method:POST
    Header:content-type: application/x-www-form-urlencoded
    Header:authorization: Basic base64(client_id:client_secret) (This header can only be used if 'client_id' and 'client_secret' are NOT found within the message body and vice versa!)
    Endpoint:/auth/oauth/v2/token
    Parameters:Parameters: grant_type=client_credentials&client_id=a-client_id&client_secret=a-client_secret&scope=a-list-of-scope-values
    Optional:scope: Only SCOPE values that have been registered for the client will be granted by the OAuth server


  • 5.  Re: Getting invalid_request while accessing oauth manager

    Posted Mar 10, 2018 06:06 AM

    Thanks Joe alot.

     

    Now I am able to get the access token but still when I am calling the protected api with access token as my query parameter ,I am getting an error:

    Am I suppose to add something to header.In this example I have just added access token to my query parameter.

     



  • 6.  Re: Getting invalid_request while accessing oauth manager

    Posted Mar 10, 2018 06:15 AM

    I also tried with the below settings.Can you please guide ,how shall I proceed further:-

     



  • 7.  Re: Getting invalid_request while accessing oauth manager

    Posted Mar 12, 2018 02:48 AM

    Thanks you Joe. 

     

    I am able to perform oauth authorization.

    Thansk for your help