authorization
Obtain Token
Obtain an access token using the OAuth2 (Password Grant) mechanism.
/oauth2/token
Usage Examples and SDK
curl -X POST \
-H "Authorization: Bearer [[accessToken]]" \
\
-H "Accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
"http://localhost:9443/buss-buss/1.0/oauth2/token"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.AuthenticationApi;
import java.io.File;
import java.util.*;
public class AuthenticationApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure Bearer (JWT) access token for authorization: Bearer_Authentication
HttpBearerAuth Bearer_Authentication = (HttpBearerAuth) defaultClient.getAuthentication("Bearer_Authentication");
Bearer_Authentication.setBearerToken("BEARER TOKEN");
// Configure OAuth2 access token for authorization: OAuth2Password
OAuth OAuth2Password = (OAuth) defaultClient.getAuthentication("OAuth2Password");
OAuth2Password.setAccessToken("YOUR ACCESS TOKEN");
// Create an instance of the API class
AuthenticationApi apiInstance = new AuthenticationApi();
String grantType = grantType_example; // String |
String username = username_example; // String |
String password = password_example; // String |
String clientId = clientId_example; // String |
String clientSecret = clientSecret_example; // String |
try {
Authorization_200_response result = apiInstance.authorization(grantType, username, password, clientId, clientSecret);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#authorization");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String grantType = new String(); // String |
final String username = new String(); // String |
final String password = new String(); // String |
final String clientId = new String(); // String |
final String clientSecret = new String(); // String |
try {
final result = await api_instance.authorization(grantType, username, password, clientId, clientSecret);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->authorization: $e\n');
}
import org.openapitools.client.api.AuthenticationApi;
public class AuthenticationApiExample {
public static void main(String[] args) {
AuthenticationApi apiInstance = new AuthenticationApi();
String grantType = grantType_example; // String |
String username = username_example; // String |
String password = password_example; // String |
String clientId = clientId_example; // String |
String clientSecret = clientSecret_example; // String |
try {
Authorization_200_response result = apiInstance.authorization(grantType, username, password, clientId, clientSecret);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#authorization");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure Bearer (JWT) access token for authorization: Bearer_Authentication
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Configure OAuth2 access token for authorization: (authentication scheme: OAuth2Password)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Create an instance of the API class
AuthenticationApi *apiInstance = [[AuthenticationApi alloc] init];
String *grantType = grantType_example; // (optional) (default to null)
String *username = username_example; // (optional) (default to null)
String *password = password_example; // (optional) (default to null)
String *clientId = clientId_example; // (optional) (default to null)
String *clientSecret = clientSecret_example; // (optional) (default to null)
// Obtain Token
[apiInstance authorizationWith:grantType
username:username
password:password
clientId:clientId
clientSecret:clientSecret
completionHandler: ^(Authorization_200_response output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var ApiDocumentationIpotekaOtpBank = require('api_documentation_ipoteka_otp_bank');
var defaultClient = ApiDocumentationIpotekaOtpBank.ApiClient.instance;
// Configure Bearer (JWT) access token for authorization: Bearer_Authentication
var Bearer_Authentication = defaultClient.authentications['Bearer_Authentication'];
Bearer_Authentication.accessToken = "YOUR ACCESS TOKEN";
// Configure OAuth2 access token for authorization: OAuth2Password
var OAuth2Password = defaultClient.authentications['OAuth2Password'];
OAuth2Password.accessToken = "YOUR ACCESS TOKEN";
// Create an instance of the API class
var api = new ApiDocumentationIpotekaOtpBank.AuthenticationApi()
var opts = {
'grantType': grantType_example, // {String}
'username': username_example, // {String}
'password': password_example, // {String}
'clientId': clientId_example, // {String}
'clientSecret': clientSecret_example // {String}
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.authorization(opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class authorizationExample
{
public void main()
{
// Configure Bearer (JWT) access token for authorization: Bearer_Authentication
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
// Configure OAuth2 access token for authorization: OAuth2Password
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
// Create an instance of the API class
var apiInstance = new AuthenticationApi();
var grantType = grantType_example; // String | (optional) (default to null)
var username = username_example; // String | (optional) (default to null)
var password = password_example; // String | (optional) (default to null)
var clientId = clientId_example; // String | (optional) (default to null)
var clientSecret = clientSecret_example; // String | (optional) (default to null)
try {
// Obtain Token
Authorization_200_response result = apiInstance.authorization(grantType, username, password, clientId, clientSecret);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthenticationApi.authorization: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer (JWT) access token for authorization: Bearer_Authentication
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('', 'YOUR_ACCESS_TOKEN');
// Configure OAuth2 access token for authorization: OAuth2Password
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthenticationApi();
$grantType = grantType_example; // String |
$username = username_example; // String |
$password = password_example; // String |
$clientId = clientId_example; // String |
$clientSecret = clientSecret_example; // String |
try {
$result = $api_instance->authorization($grantType, $username, $password, $clientId, $clientSecret);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->authorization: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::AuthenticationApi;
# Configure Bearer (JWT) access token for authorization: Bearer_Authentication
$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
# Configure OAuth2 access token for authorization: OAuth2Password
$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::AuthenticationApi->new();
my $grantType = grantType_example; # String |
my $username = username_example; # String |
my $password = password_example; # String |
my $clientId = clientId_example; # String |
my $clientSecret = clientSecret_example; # String |
eval {
my $result = $api_instance->authorization(grantType => $grantType, username => $username, password => $password, clientId => $clientId, clientSecret => $clientSecret);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthenticationApi->authorization: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure Bearer (JWT) access token for authorization: Bearer_Authentication
openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Configure OAuth2 access token for authorization: OAuth2Password
openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Create an instance of the API class
api_instance = openapi_client.AuthenticationApi()
grantType = grantType_example # String | (optional) (default to null)
username = username_example # String | (optional) (default to null)
password = password_example # String | (optional) (default to null)
clientId = clientId_example # String | (optional) (default to null)
clientSecret = clientSecret_example # String | (optional) (default to null)
try:
# Obtain Token
api_response = api_instance.authorization(grantType=grantType, username=username, password=password, clientId=clientId, clientSecret=clientSecret)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthenticationApi->authorization: %s\n" % e)
extern crate AuthenticationApi;
pub fn main() {
let grantType = grantType_example; // String
let username = username_example; // String
let password = password_example; // String
let clientId = clientId_example; // String
let clientSecret = clientSecret_example; // String
let mut context = AuthenticationApi::Context::default();
let result = client.authorization(grantType, username, password, clientId, clientSecret, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
grant_type | |
username | |
password | |
client_id | |
client_secret |