Skip to main content

PKCE API

All URIs are relative to http://localhost:1000

MethodHTTP requestDescription
clear_pkcePOST /pkce/clear/pkce/clear [POST]
generate_codePOST /pkce/code/pkce/code [POST]
generate_tokenPOST /pkce/token/pkce/token [POST]
get_challengeGET /pkce/challengeYour GET endpoint
respond_with_codePOST /pkce/response/code/pkce/response/code [POST]

clear_pkce​

clear_pkce()

/pkce/clear [POST]

This is a function to Clear a PKCE Authentication Flow

Example​

import pieces_os_client
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.PKCEApi(api_client)

try:
# /pkce/clear [POST]
api_instance.clear_pkce()
except Exception as e:
print("Exception when calling PKCEApi->clear_pkce: %s\n" % e)

Parameters​

This endpoint does not need any parameters.

Return type​

void (empty response body)

Authorization​

No authorization required

HTTP request headers​

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details​

Status codeDescriptionResponse headers
204No Content-

generate_code​

PKCE generate_code(seeded_pkce=seeded_pkce)

/pkce/code [POST]

An endpoint to get the PKCE Code - this endpoint proxies the call out to Authorize within Auth0

Example​

import pieces_os_client
from pieces_os_client.models.pkce import PKCE
from pieces_os_client.models.seeded_pkce import SeededPKCE
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.PKCEApi(api_client)
seeded_pkce = pieces_os_client.SeededPKCE() # SeededPKCE | All of the properties that the client might want to send over to authorize a PKCE Code Flow (optional)

try:
# /pkce/code [POST]
api_response = api_instance.generate_code(seeded_pkce=seeded_pkce)
print("The response of PKCEApi->generate_code:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PKCEApi->generate_code: %s\n" % e)

Parameters​

NameTypeDescriptionNotes
seeded_pkceSeededPKCEAll of the properties that the client might want to send over to authorize a PKCE Code Flow[optional]

Return type​

PKCE

Authorization​

No authorization required

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json

HTTP response details​

Status codeDescriptionResponse headers
200OK-

generate_token​

PKCE generate_token(tokenized_pkce=tokenized_pkce)

/pkce/token [POST]

A proxy endpoint for PKCE token generation, internally calls Auth0 /oauth/token

Example​

import pieces_os_client
from pieces_os_client.models.pkce import PKCE
from pieces_os_client.models.tokenized_pkce import TokenizedPKCE
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.PKCEApi(api_client)
tokenized_pkce = pieces_os_client.TokenizedPKCE() # TokenizedPKCE | The needed properties to exchange a PKCE Code for an OAuth Token (optional)

try:
# /pkce/token [POST]
api_response = api_instance.generate_token(tokenized_pkce=tokenized_pkce)
print("The response of PKCEApi->generate_token:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PKCEApi->generate_token: %s\n" % e)

Parameters​

NameTypeDescriptionNotes
tokenized_pkceTokenizedPKCEThe needed properties to exchange a PKCE Code for an OAuth Token[optional]

Return type​

PKCE

Authorization​

No authorization required

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json

HTTP response details​

Status codeDescriptionResponse headers
200OK-

get_challenge​

PKCE get_challenge()

Your GET endpoint

An endpoint that returns a PKCE Challenge

Example​

import pieces_os_client
from pieces_os_client.models.pkce import PKCE
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.PKCEApi(api_client)

try:
# Your GET endpoint
api_response = api_instance.get_challenge()
print("The response of PKCEApi->get_challenge:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PKCEApi->get_challenge: %s\n" % e)

Parameters​

This endpoint does not need any parameters.

Return type​

PKCE

Authorization​

No authorization required

HTTP request headers​

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details​

Status codeDescriptionResponse headers
200OK-

respond_with_code​

PKCE respond_with_code(code, state, var_schema=var_schema)

/pkce/response/code [POST]

This is a callback function hosted to help pass along the ResultedPKCE code from authorize through to the callback.

Example​

import pieces_os_client
from pieces_os_client.models.embedded_model_schema import EmbeddedModelSchema
from pieces_os_client.models.pkce import PKCE
from pieces_os_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:1000
# See configuration.py for a list of all supported configuration parameters.
configuration = pieces_os_client.Configuration(
host="http://localhost:1000"
)


# Enter a context with an instance of the API client
with pieces_os_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pieces_os_client.PKCEApi(api_client)
code = 'code_example' # str | The PKCE Code to be used to access a Token.
state = 'state_example' # str | Likely the state that will be returned which should match the requested state as well as the nonce
var_schema = pieces_os_client.EmbeddedModelSchema() # EmbeddedModelSchema | (optional)

try:
# /pkce/response/code [POST]
api_response = api_instance.respond_with_code(code, state, var_schema=var_schema)
print("The response of PKCEApi->respond_with_code:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling PKCEApi->respond_with_code: %s\n" % e)

Parameters​

NameTypeDescriptionNotes
codestrThe PKCE Code to be used to access a Token.
statestrLikely the state that will be returned which should match the requested state as well as the nonce
var_schemaEmbeddedModelSchema[optional]

Return type​

PKCE

Authorization​

No authorization required

HTTP request headers​

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json, text/html

HTTP response details​

Status codeDescriptionResponse headers
200OK-