Results 1 to 3 of 3

Thread: How possible get API token ?

Threaded View

  1. #1

    Thread Starter
    Addicted Member sergeos's Avatar
    Join Date
    Apr 2009
    Location
    Belarus
    Posts
    167

    Angry How possible get API token ?

    Hi!
    How possible use any Http client (I think in vb that named like as "MSXML2.XMLHTTP" or anything else) for getting token?
    I can't adding parameter { "grant_type", "client_credentials" }
    All times get error, what
    {"error":"invalid_request","error_description":"The grant type was not specified in the request"}
    Very long time search solution but without results.
    In one forum I found this: http://stackoverflow.com/questions/3...in-asp-net-mvc

    But, how this code transpose to VB6.0? How use parameters client_credentials?

    And samples
    with curl:
    Code:
    curl -u 204da9b95e2480a3455f:7a4bbb61262fdf41d410645292a0489ba752c6b9 https://api.stormpath.com/v1/applications/$YOUR_APPLICATION_ID \
    -H 'Accept: application/json' -d 'grant_type=client_credentials'
    with php:
    PHP Code:
    $process curl_init("https://api.stormpath.com/v1/applications/$YOUR_APPLICATION_ID");
    curl_setopt($processCURLOPT_HTTPHEADER, array('Accept: application/json'));
    curl_setopt($processCURLOPT_USERPWD"204da9b95e2480a3455f:7a4bbb61262fdf41d410645292a0489ba752c6b9");
    curl_setopt($processCURLOPT_POST1);
    curl_setopt($processCURLOPT_RETURNTRANSFERTRUE);
    curl_setopt($processCURLOPT_POSTFIELDS, array('grant_type' => 'client_credentials'));
    $result curl_exec($process);
    curl_close($process); 
    Also, they wrote:
    To receive an authorization token, you must send a POST request indicating Basic Authentication to the authorization address (https://api.stormpath.com/v1/applica...APPLICATION_ID). The parameters for authorization must be Client ID and Client Secret from the OAuth application settings page. It is also necessary to pass the POST request parameter grant_type with the value client_credentials
    And
    The resource is available only through the HTTPS protocol.
    For all requests, you must specify the HTTP header 'Accept'. By default, it must be passed with 'application / json'.
    Last edited by sergeos; Mar 20th, 2017 at 05:45 AM.
    Ten Years After - 01 You Give Me Loving

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width