getAccessToken
Get access token - to be used as Bearer token header for all other API requests.
/oauth2
Usage and SDK Samples
curl -X POST \
-H "X-API-KEY: [[apiKey]]" \
-H "Authorization: Bearer [[accessToken]]" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
"https://localhost:16006/api/v1/oauth2?newPassword=newPassword_example&forgotPassword=true&requirements=true&resendMFACode=true&completeMFAChallenge=true&grant_type=refresh_token" \
-d ''
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 API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
// Configure Bearer (JWT) access token for authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken("BEARER TOKEN");
// Create an instance of the API class
AuthenticationApi apiInstance = new AuthenticationApi();
GetAccessTokenRequest getAccessTokenRequest = ; // GetAccessTokenRequest |
String newPassword = newPassword_example; // String | used when a user is trying to change her password. This will be the new password.
Boolean forgotPassword = true; // Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true
Boolean requirements = true; // Boolean | A user forgot her password. This will provided the password requirements.
Boolean resendMFACode = true; // Boolean |
Boolean completeMFAChallenge = true; // Boolean |
String grantType = refresh_token; // String |
try {
getAccessToken_200_response result = apiInstance.getAccessToken(getAccessTokenRequest, newPassword, forgotPassword, requirements, resendMFACode, completeMFAChallenge, grantType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#getAccessToken");
e.printStackTrace();
}
}
}
import org.openapitools.client.api.AuthenticationApi;
public class AuthenticationApiExample {
public static void main(String[] args) {
AuthenticationApi apiInstance = new AuthenticationApi();
GetAccessTokenRequest getAccessTokenRequest = ; // GetAccessTokenRequest |
String newPassword = newPassword_example; // String | used when a user is trying to change her password. This will be the new password.
Boolean forgotPassword = true; // Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true
Boolean requirements = true; // Boolean | A user forgot her password. This will provided the password requirements.
Boolean resendMFACode = true; // Boolean |
Boolean completeMFAChallenge = true; // Boolean |
String grantType = refresh_token; // String |
try {
getAccessToken_200_response result = apiInstance.getAccessToken(getAccessTokenRequest, newPassword, forgotPassword, requirements, resendMFACode, completeMFAChallenge, grantType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#getAccessToken");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"X-API-KEY"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"X-API-KEY"];
// Configure Bearer (JWT) access token for authorization: bearerAuth
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Create an instance of the API class
AuthenticationApi *apiInstance = [[AuthenticationApi alloc] init];
GetAccessTokenRequest *getAccessTokenRequest = ; //
String *newPassword = newPassword_example; // used when a user is trying to change her password. This will be the new password. (optional) (default to null)
Boolean *forgotPassword = true; // A user forgot her password. She needs to present her e-mail address in the userId and set this to true (optional) (default to null)
Boolean *requirements = true; // A user forgot her password. This will provided the password requirements. (optional) (default to null)
Boolean *resendMFACode = true; // (optional) (default to null)
Boolean *completeMFAChallenge = true; // (optional) (default to null)
String *grantType = refresh_token; // (optional) (default to null)
// Get access token - to be used as Bearer token header for all other API requests.
[apiInstance getAccessTokenWith:getAccessTokenRequest
newPassword:newPassword
forgotPassword:forgotPassword
requirements:requirements
resendMFACode:resendMFACode
completeMFAChallenge:completeMFAChallenge
grantType:grantType
completionHandler: ^(getAccessToken_200_response output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var OpenWiFiUserPortal = require('open_wi_fi_user_portal');
var defaultClient = OpenWiFiUserPortal.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['X-API-KEY'] = "Token";
// Configure Bearer (JWT) access token for authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.accessToken = "YOUR ACCESS TOKEN";
// Create an instance of the API class
var api = new OpenWiFiUserPortal.AuthenticationApi()
var getAccessTokenRequest = ; // {GetAccessTokenRequest}
var opts = {
'newPassword': newPassword_example, // {String} used when a user is trying to change her password. This will be the new password.
'forgotPassword': true, // {Boolean} A user forgot her password. She needs to present her e-mail address in the userId and set this to true
'requirements': true, // {Boolean} A user forgot her password. This will provided the password requirements.
'resendMFACode': true, // {Boolean}
'completeMFAChallenge': true, // {Boolean}
'grantType': refresh_token // {String}
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.getAccessToken(getAccessTokenRequest, opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class getAccessTokenExample
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("X-API-KEY", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("X-API-KEY", "Bearer");
// Configure Bearer (JWT) access token for authorization: bearerAuth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
// Create an instance of the API class
var apiInstance = new AuthenticationApi();
var getAccessTokenRequest = new GetAccessTokenRequest(); // GetAccessTokenRequest |
var newPassword = newPassword_example; // String | used when a user is trying to change her password. This will be the new password. (optional) (default to null)
var forgotPassword = true; // Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true (optional) (default to null)
var requirements = true; // Boolean | A user forgot her password. This will provided the password requirements. (optional) (default to null)
var resendMFACode = true; // Boolean | (optional) (default to null)
var completeMFAChallenge = true; // Boolean | (optional) (default to null)
var grantType = refresh_token; // String | (optional) (default to null)
try {
// Get access token - to be used as Bearer token header for all other API requests.
getAccessToken_200_response result = apiInstance.getAccessToken(getAccessTokenRequest, newPassword, forgotPassword, requirements, resendMFACode, completeMFAChallenge, grantType);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AuthenticationApi.getAccessToken: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('X-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-KEY', 'Bearer');
// Configure Bearer (JWT) access token for authorization: bearerAuth
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setAccessToken('', 'YOUR_ACCESS_TOKEN');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthenticationApi();
$getAccessTokenRequest = ; // GetAccessTokenRequest |
$newPassword = newPassword_example; // String | used when a user is trying to change her password. This will be the new password.
$forgotPassword = true; // Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true
$requirements = true; // Boolean | A user forgot her password. This will provided the password requirements.
$resendMFACode = true; // Boolean |
$completeMFAChallenge = true; // Boolean |
$grantType = refresh_token; // String |
try {
$result = $api_instance->getAccessToken($getAccessTokenRequest, $newPassword, $forgotPassword, $requirements, $resendMFACode, $completeMFAChallenge, $grantType);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->getAccessToken: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::AuthenticationApi;
# Configure API key authorization: ApiKeyAuth
$WWW::OPenAPIClient::Configuration::api_key->{'X-API-KEY'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'X-API-KEY'} = "Bearer";
# Configure Bearer (JWT) access token for authorization: bearerAuth
$WWW::OPenAPIClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN';
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::AuthenticationApi->new();
my $getAccessTokenRequest = WWW::OPenAPIClient::Object::GetAccessTokenRequest->new(); # GetAccessTokenRequest |
my $newPassword = newPassword_example; # String | used when a user is trying to change her password. This will be the new password.
my $forgotPassword = true; # Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true
my $requirements = true; # Boolean | A user forgot her password. This will provided the password requirements.
my $resendMFACode = true; # Boolean |
my $completeMFAChallenge = true; # Boolean |
my $grantType = refresh_token; # String |
eval {
my $result = $api_instance->getAccessToken(getAccessTokenRequest => $getAccessTokenRequest, newPassword => $newPassword, forgotPassword => $forgotPassword, requirements => $requirements, resendMFACode => $resendMFACode, completeMFAChallenge => $completeMFAChallenge, grantType => $grantType);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AuthenticationApi->getAccessToken: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: ApiKeyAuth
openapi_client.configuration.api_key['X-API-KEY'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['X-API-KEY'] = 'Bearer'
# Configure Bearer (JWT) access token for authorization: bearerAuth
openapi_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Create an instance of the API class
api_instance = openapi_client.AuthenticationApi()
getAccessTokenRequest = # GetAccessTokenRequest |
newPassword = newPassword_example # String | used when a user is trying to change her password. This will be the new password. (optional) (default to null)
forgotPassword = true # Boolean | A user forgot her password. She needs to present her e-mail address in the userId and set this to true (optional) (default to null)
requirements = true # Boolean | A user forgot her password. This will provided the password requirements. (optional) (default to null)
resendMFACode = true # Boolean | (optional) (default to null)
completeMFAChallenge = true # Boolean | (optional) (default to null)
grantType = refresh_token # String | (optional) (default to null)
try:
# Get access token - to be used as Bearer token header for all other API requests.
api_response = api_instance.get_access_token(getAccessTokenRequest, newPassword=newPassword, forgotPassword=forgotPassword, requirements=requirements, resendMFACode=resendMFACode, completeMFAChallenge=completeMFAChallenge, grantType=grantType)
pprint(api_response)
except ApiException as e:
print("Exception when calling AuthenticationApi->getAccessToken: %s\n" % e)
extern crate AuthenticationApi;
pub fn main() {
let getAccessTokenRequest = ; // GetAccessTokenRequest
let newPassword = newPassword_example; // String
let forgotPassword = true; // Boolean
let requirements = true; // Boolean
let resendMFACode = true; // Boolean
let completeMFAChallenge = true; // Boolean
let grantType = refresh_token; // String
let mut context = AuthenticationApi::Context::default();
let result = client.getAccessToken(getAccessTokenRequest, newPassword, forgotPassword, requirements, resendMFACode, completeMFAChallenge, grantType, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
Name | Description |
---|---|
getAccessTokenRequest * |
User id and password |
Name | Description |
---|---|
newPassword |
String
used when a user is trying to change her password. This will be the new password.
|
forgotPassword |
Boolean
A user forgot her password. She needs to present her e-mail address in the userId and set this to true
|
requirements |
Boolean
A user forgot her password. This will provided the password requirements.
|
resendMFACode |
Boolean
|
completeMFAChallenge |
Boolean
|
grant_type |
String
|