unsupported_grant_type

Hi

I am trying to test connectivity for my WebSocket API application (what I need https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Python.TRNA/blob/master/notebook/mrn_realtime_news_notebook_app.ipynb).


The command I am trying:

curl --data-urlencode "grant_type=password&takeExclusiveSignOnControl=True&scope=trapi&username=GE-myusername&password=mypassword" -X POST -H "Accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -v https://api.refinitiv.com:443/auth/oauth2/v1/token


The response I have is {"error":"unsupported_grant_type" }.

I appreciate if you can help me to resolve this issue.


Thanks

Vera

Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓

    Hello @Vera Ekimenko

    Could you please try with the following curl command?

    curl --location --request POST 'https://api.refinitiv.com/auth/oauth2/v1/token'; \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --header 'Authorization: Bearer ' \
    --data-urlencode 'username=<Username/Machine ID>' \
    --data-urlencode 'password=<Password>' \
    --data-urlencode 'grant_type=password' \
    --data-urlencode 'scope=trapi' \
    --data-urlencode 'takeExclusiveSignOnControl=true' \
    --data-urlencode 'client_id=<App Key>'

    I noticed that your curl command does not contain the client_id parameter as well.

    The Refinitiv Real-Time Optimized (formerly known as ERT in Cloud) uses RDP APIs authentication. I suggest you check the following resources about RDP authentications:

    Alternatively, you may use the Postman collection to verify your RDP/Machine ID credentials.

Answers

  • Hi Wasin


    Thank you for a prompt response. I have generated client_id using this


    " target="_blank">https://emea1.apps.cp.thomsonreuters.com/apps/AppkeyGenerator

    The Product is 'DEVPORTALUNQUALIFIEDCONTACTS.VERAEKIMENKO' which is not what my organisation is using (TRNA).


    When I am trying to post a request from your Postman collection 'Authentication/Get Access Token' with the values set in RDP Env Starter environment (usename, password, client_id generated above) I have an error:

    {

    "error": "access_denied",

    "error_description": "Invalid username or password."

    }


    How to get the correct client_id?

    Thank you

    Vera


  • Hi Wasin


    Update: I have tried your curl command and it works with my client_id :). I'll try it with my app and post if I have any issues. Thank you for your help.


    Thank you

    Vera Ekimenko

  • Hello @Vera Ekimenko

    The Curl and Postman results should be identical with the same credentials. I suggest you check the Postman setting guide in the RDP Postman tutorial.

    image