Skip to main content

PKCE API

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

MethodHTTP requestDescription
clearPKCEPOST /pkce/clear/pkce/clear [POST]
generateCodePOST /pkce/code/pkce/code [POST]
generateTokenPOST /pkce/token/pkce/token [POST]
getChallengeGET /pkce/challengeYour GET endpoint
respondWithCodePOST /pkce/response/code/pkce/response/code [POST]

clearPKCE​

clearPKCE()

This is a function to Clear a PKCE Authentication Flow

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.PKCEApi(configuration)

apiInstance.clearPKCE().then((data: void (empty response body)) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

This endpoint does not need any parameters.

Return type​

void (empty response body)

HTTP request headers​

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

HTTP response details​

Status codeDescriptionResponse headers
204No Content-

generateCode​

PKCE generateCode()

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

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.PKCEApi(configuration)

const body: Pieces.GenerateCodeRequest = {
// SeededPKCE | All of the properties that the client might want to send over to authorize a PKCE Code Flow (optional)
seededPKCE: ,
};

apiInstance.generateCode(body).then((data: PKCE) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

NameTypeDescriptionNotes
seededPKCESeededPKCEAll of the properties that the client might want to send over to authorize a PKCE Code Flow

Return type​

PKCE

HTTP request headers​

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

HTTP response details​

Status codeDescriptionResponse headers
200OK-

generateToken​

PKCE generateToken()

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

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.PKCEApi(configuration)

const body: Pieces.GenerateTokenRequest = {
// TokenizedPKCE | The needed properties to exchange a PKCE Code for an OAuth Token (optional)
tokenizedPKCE: ,
};

apiInstance.generateToken(body).then((data: PKCE) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

NameTypeDescriptionNotes
tokenizedPKCETokenizedPKCEThe needed properties to exchange a PKCE Code for an OAuth Token

Return type​

PKCE

HTTP request headers​

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

HTTP response details​

Status codeDescriptionResponse headers
200OK-

getChallenge​

PKCE getChallenge()

An endpoint that returns a PKCE Challenge

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.PKCEApi(configuration)

apiInstance.getChallenge().then((data: PKCE) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

This endpoint does not need any parameters.

Return type​

PKCE

HTTP request headers​

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

HTTP response details​

Status codeDescriptionResponse headers
200OK-

respondWithCode​

PKCE respondWithCode()

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

Example​

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.PKCEApi(configuration)

const body: Pieces.RespondWithCodeRequest = {
// string | The PKCE Code to be used to access a Token.
code: code_example,
// string | Likely the state that will be returned which should match the requested state as well as the nonce
state: state_example,
// EmbeddedModelSchema (optional)
schema: ,
};

apiInstance.respondWithCode(body).then((data: PKCE) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters​

NameTypeDescriptionNotes
code[string]The PKCE Code to be used to access a Token.defaults to undefined
state[string]Likely the state that will be returned which should match the requested state as well as the noncedefaults to undefined
schemaEmbeddedModelSchema(optional) defaults to undefined

Return type​

PKCE

HTTP request headers​

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

HTTP response details​

Status codeDescriptionResponse headers
200OK-