tokenPost
Obtener token de acceso o refrescar token
/token
Usage and SDK Samples
curl -X POST\
-H "Accept: application/json"\
"https://sso.dev.claroshop.com/auth/realms/{realm_name}/protocol/openid-connect/token?grant_type=&client_id=&username=&password=&refresh_token="
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.DefaultApi;
import java.io.File;
import java.util.*;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
String grantType = grantType_example; // String |
String clientId = clientId_example; // String |
String username = username_example; // String |
String password = password_example; // String |
String refreshToken = refreshToken_example; // String |
try {
inline_response_200 result = apiInstance.tokenPost(grantType, clientId, username, password, refreshToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#tokenPost");
e.printStackTrace();
}
}
}
import io.swagger.client.api.DefaultApi;
public class DefaultApiExample {
public static void main(String[] args) {
DefaultApi apiInstance = new DefaultApi();
String grantType = grantType_example; // String |
String clientId = clientId_example; // String |
String username = username_example; // String |
String password = password_example; // String |
String refreshToken = refreshToken_example; // String |
try {
inline_response_200 result = apiInstance.tokenPost(grantType, clientId, username, password, refreshToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DefaultApi#tokenPost");
e.printStackTrace();
}
}
}
String *grantType = grantType_example; //
String *clientId = clientId_example; //
String *username = username_example; // (optional)
String *password = password_example; // (optional)
String *refreshToken = refreshToken_example; // (optional)
DefaultApi *apiInstance = [[DefaultApi alloc] init];
// Obtener token de acceso o refrescar token
[apiInstance tokenPostWith:grantType
clientId:clientId
username:username
password:password
refreshToken:refreshToken
completionHandler: ^(inline_response_200 output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var KeycloakTokenApi = require('keycloak_token_api');
var api = new KeycloakTokenApi.DefaultApi()
var grantType = grantType_example; // {{String}}
var clientId = clientId_example; // {{String}}
var opts = {
'username': username_example, // {{String}}
'password': password_example, // {{String}}
'refreshToken': refreshToken_example // {{String}}
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.tokenPost(grantType, clientId, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class tokenPostExample
{
public void main()
{
var apiInstance = new DefaultApi();
var grantType = grantType_example; // String |
var clientId = clientId_example; // String |
var username = username_example; // String | (optional)
var password = password_example; // String | (optional)
var refreshToken = refreshToken_example; // String | (optional)
try
{
// Obtener token de acceso o refrescar token
inline_response_200 result = apiInstance.tokenPost(grantType, clientId, username, password, refreshToken);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling DefaultApi.tokenPost: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\ApiDefaultApi();
$grantType = grantType_example; // String |
$clientId = clientId_example; // String |
$username = username_example; // String |
$password = password_example; // String |
$refreshToken = refreshToken_example; // String |
try {
$result = $api_instance->tokenPost($grantType, $clientId, $username, $password, $refreshToken);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->tokenPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::DefaultApi;
my $api_instance = WWW::SwaggerClient::DefaultApi->new();
my $grantType = grantType_example; # String |
my $clientId = clientId_example; # String |
my $username = username_example; # String |
my $password = password_example; # String |
my $refreshToken = refreshToken_example; # String |
eval {
my $result = $api_instance->tokenPost(grantType => $grantType, clientId => $clientId, username => $username, password => $password, refreshToken => $refreshToken);
print Dumper($result);
};
if ($@) {
warn "Exception when calling DefaultApi->tokenPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.DefaultApi()
grantType = grantType_example # String |
clientId = clientId_example # String |
username = username_example # String | (optional)
password = password_example # String | (optional)
refreshToken = refreshToken_example # String | (optional)
try:
# Obtener token de acceso o refrescar token
api_response = api_instance.token_post(grantType, clientId, username=username, password=password, refreshToken=refreshToken)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->tokenPost: %s\n" % e)
Parameters
Query parameters
Name | Description |
---|---|
grant_type* |
String
Required
|
client_id* |
String
Required
|
username |
String
|
password |
String
|
refresh_token |
String
|