consentPage
Renders the consent page
Renders the page the authorization endpoint redirects to when a client needs the user's approval: the client, the requested scopes (as checkboxes, checked by default) and the scopes granted earlier. The decision is posted to the authorization endpoint (POST /oauth2/authorize), or to the device verification endpoint for a device, never to this operation.
/oauth2/consent
Usage and SDK Samples
curl -X GET \
\
-H "Accept: text/html" \
"http://localhost:9000/oauth2/consent?client_id=clientId_example&scope=scope_example&state=state_example&user_code=userCode_example"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.ConsentPageApi;
import java.io.File;
import java.util.*;
public class ConsentPageApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: session
ApiKeyAuth session = (ApiKeyAuth) defaultClient.getAuthentication("session");
session.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.setApiKeyPrefix("Token");
// Create an instance of the API class
ConsentPageApi apiInstance = new ConsentPageApi();
String clientId = clientId_example; // String | Identifier of the registered client that asks for access.
String scope = scope_example; // String | Requested scopes, space delimited as in the authorization request.
String state = state_example; // String | State the authorization endpoint generated for the consent step, posted back with the decision.
String userCode = userCode_example; // String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
try {
'String' result = apiInstance.consentPage(clientId, scope, state, userCode);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConsentPageApi#consentPage");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String clientId = new String(); // String | Identifier of the registered client that asks for access.
final String scope = new String(); // String | Requested scopes, space delimited as in the authorization request.
final String state = new String(); // String | State the authorization endpoint generated for the consent step, posted back with the decision.
final String userCode = new String(); // String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
try {
final result = await api_instance.consentPage(clientId, scope, state, userCode);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->consentPage: $e\n');
}
import org.openapitools.client.api.ConsentPageApi;
public class ConsentPageApiExample {
public static void main(String[] args) {
ConsentPageApi apiInstance = new ConsentPageApi();
String clientId = clientId_example; // String | Identifier of the registered client that asks for access.
String scope = scope_example; // String | Requested scopes, space delimited as in the authorization request.
String state = state_example; // String | State the authorization endpoint generated for the consent step, posted back with the decision.
String userCode = userCode_example; // String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
try {
'String' result = apiInstance.consentPage(clientId, scope, state, userCode);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConsentPageApi#consentPage");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: session)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"JSESSIONID"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"JSESSIONID"];
// Create an instance of the API class
ConsentPageApi *apiInstance = [[ConsentPageApi alloc] init];
String *clientId = clientId_example; // Identifier of the registered client that asks for access. (default to null)
String *scope = scope_example; // Requested scopes, space delimited as in the authorization request. (default to null)
String *state = state_example; // State the authorization endpoint generated for the consent step, posted back with the decision. (default to null)
String *userCode = userCode_example; // Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code. (optional) (default to null)
// Renders the consent page
[apiInstance consentPageWith:clientId
scope:scope
state:state
userCode:userCode
completionHandler: ^('String' output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var IruruetaAuthServerPages = require('irurueta_auth_server_pages');
var defaultClient = IruruetaAuthServerPages.ApiClient.instance;
// Configure API key authorization: session
var session = defaultClient.authentications['session'];
session.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//session.apiKeyPrefix['JSESSIONID'] = "Token";
// Create an instance of the API class
var api = new IruruetaAuthServerPages.ConsentPageApi()
var clientId = clientId_example; // {String} Identifier of the registered client that asks for access.
var scope = scope_example; // {String} Requested scopes, space delimited as in the authorization request.
var state = state_example; // {String} State the authorization endpoint generated for the consent step, posted back with the decision.
var opts = {
'userCode': userCode_example // {String} Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.consentPage(clientId, scope, state, opts, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class consentPageExample
{
public void main()
{
// Configure API key authorization: session
Configuration.Default.ApiKey.Add("JSESSIONID", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("JSESSIONID", "Bearer");
// Create an instance of the API class
var apiInstance = new ConsentPageApi();
var clientId = clientId_example; // String | Identifier of the registered client that asks for access. (default to null)
var scope = scope_example; // String | Requested scopes, space delimited as in the authorization request. (default to null)
var state = state_example; // String | State the authorization endpoint generated for the consent step, posted back with the decision. (default to null)
var userCode = userCode_example; // String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code. (optional) (default to null)
try {
// Renders the consent page
'String' result = apiInstance.consentPage(clientId, scope, state, userCode);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling ConsentPageApi.consentPage: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: session
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('JSESSIONID', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('JSESSIONID', 'Bearer');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\ConsentPageApi();
$clientId = clientId_example; // String | Identifier of the registered client that asks for access.
$scope = scope_example; // String | Requested scopes, space delimited as in the authorization request.
$state = state_example; // String | State the authorization endpoint generated for the consent step, posted back with the decision.
$userCode = userCode_example; // String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
try {
$result = $api_instance->consentPage($clientId, $scope, $state, $userCode);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling ConsentPageApi->consentPage: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::ConsentPageApi;
# Configure API key authorization: session
$WWW::OPenAPIClient::Configuration::api_key->{'JSESSIONID'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'JSESSIONID'} = "Bearer";
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::ConsentPageApi->new();
my $clientId = clientId_example; # String | Identifier of the registered client that asks for access.
my $scope = scope_example; # String | Requested scopes, space delimited as in the authorization request.
my $state = state_example; # String | State the authorization endpoint generated for the consent step, posted back with the decision.
my $userCode = userCode_example; # String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
eval {
my $result = $api_instance->consentPage(clientId => $clientId, scope => $scope, state => $state, userCode => $userCode);
print Dumper($result);
};
if ($@) {
warn "Exception when calling ConsentPageApi->consentPage: $@\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: session
openapi_client.configuration.api_key['JSESSIONID'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['JSESSIONID'] = 'Bearer'
# Create an instance of the API class
api_instance = openapi_client.ConsentPageApi()
clientId = clientId_example # String | Identifier of the registered client that asks for access. (default to null)
scope = scope_example # String | Requested scopes, space delimited as in the authorization request. (default to null)
state = state_example # String | State the authorization endpoint generated for the consent step, posted back with the decision. (default to null)
userCode = userCode_example # String | Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code. (optional) (default to null)
try:
# Renders the consent page
api_response = api_instance.consent_page(clientId, scope, state, userCode=userCode)
pprint(api_response)
except ApiException as e:
print("Exception when calling ConsentPageApi->consentPage: %s\n" % e)
extern crate ConsentPageApi;
pub fn main() {
let clientId = clientId_example; // String
let scope = scope_example; // String
let state = state_example; // String
let userCode = userCode_example; // String
let mut context = ConsentPageApi::Context::default();
let result = client.consentPage(clientId, scope, state, userCode, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
| Name | Description |
|---|---|
| client_id* |
String
Identifier of the registered client that asks for access.
Required
|
| scope* |
String
Requested scopes, space delimited as in the authorization request.
Required
|
| state* |
String
State the authorization endpoint generated for the consent step, posted back with the decision.
Required
|
| user_code |
String
Present when the consent is asked for a device (OAuth 2.0 Device Authorization Grant): the user code of the request. The decision is then posted to the device verification endpoint (POST /oauth2/device_verification) instead, with this code.
|