--- title: "AcknowledgeChallenge" slug: "150-manage-acknowledgechallenge" updated: 2025-03-19T17:34:43Z published: 2025-03-19T17:34:43Z canonical: "docs.developer.comcast.com/150-manage-acknowledgechallenge" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # AcknowledgeChallenge **AcknowledgeChallenge Module 1.5.0 | Manage SDK** ## Usage To use the AcknowledgeChallenge module, you can import it into your project from the Firebolt SDK: ``` import { AcknowledgeChallenge } from '@firebolt-js/manage-sdk' ``` ## Overview A module for registering as a provider for a user grant in which the user confirms access to a capability ## Methods ### provide To provide a specific capability to the platform. See [Provider Interfaces](/docs/150-manage-acknowledgechallenge#provider-interfaces) for a list of interfaces available to provide in this module. ``` provide(capability: string, provider: any): void ``` Parameters: | Param | Type | Required | Summary | | --- | --- | --- | --- | | `capability` | `string` | Yes | The capability that is being provided. | | `provider` | `any` | Yes | An implementation of the required interface. | See [Provider Interfaces](/docs/150-manage-acknowledgechallenge#provider-interfaces) for each capabilities interface definition. ## Private Methods **View** ### challengeError *This is a private RPC method.* Internal API for Challenge Provider to send back error. Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `correlationId` | `string` | true | | | `error` | `object` | true | | Result: Capabilities: | Role | Capability | | --- | --- | | provides | xrn:firebolt:capability:usergrant:acknowledgechallenge | #### Examples Example 1 JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.challengeError", "params": { "correlationId": "123", "error": { "code": 1, "message": "Error" } } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ### challengeFocus *This is a private RPC method.* Internal API for Challenge Provider to request focus for UX purposes. Result: Capabilities: | Role | Capability | | --- | --- | | provides | xrn:firebolt:capability:usergrant:acknowledgechallenge | #### Examples Example JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.challengeFocus", "params": {} } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ### challengeResponse *This is a private RPC method.* Internal API for Challenge Provider to send back response. Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `correlationId` | `string` | true | | | `result` | [`GrantResult`](/docs/150-manage-acknowledgechallenge#grantresult) | true | | Result: Capabilities: | Role | Capability | | --- | --- | | provides | xrn:firebolt:capability:usergrant:acknowledgechallenge | #### Examples Example #1 JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.challengeResponse", "params": { "correlationId": "123", "result": { "granted": true } } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` Example #2 JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.challengeResponse", "params": { "correlationId": "123", "result": { "granted": false } } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` Example #3 JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.challengeResponse", "params": { "correlationId": "123", "result": { "granted": null } } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ## Private Events **View** ### onRequestChallenge *This is a private RPC method.* Registers as a provider for when the user should be challenged in order to confirm access to a capability Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `listen` | `boolean` | true | | Result: [ChallengeProviderRequest](/docs/150-manage-acknowledgechallenge#challengeproviderrequest) Capabilities: | Role | Capability | | --- | --- | | provides | xrn:firebolt:capability:usergrant:acknowledgechallenge | #### Examples Default Example JSON-RPC: Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "AcknowledgeChallenge.onRequestChallenge", "params": { "listen": true } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": { "correlationId": "abc", "parameters": { "capability": "xrn:firebolt:capability:localization::postal-code", "requestor": { "id": "ReferenceApp", "name": "Firebolt Reference App" } } } } ``` --- ## Provider Interfaces ### ChallengeProvider The provider interface for the `xrn:firebolt:capability:usergrant:acknowledgechallenge` capability. ``` ``` Usage: ``` AcknowledgeChallenge.provide('xrn:firebolt:capability:usergrant:acknowledgechallenge', provider: ChallengeProvider | object) ``` #### Examples **Register your app to provide the `xrn:firebolt:capability:usergrant:acknowledgechallenge` capability.** ``` import { AcknowledgeChallenge } from '@firebolt-js/manage-sdk' class MyChallengeProvider { async challenge(parameters, session) { return { granted: true, } } } AcknowledgeChallenge.provide( 'xrn:firebolt:capability:usergrant:acknowledgechallenge', new MyChallengeProvider(), ) ``` **JSON-RPC** **Register to recieve each provider API** Request: ``` { "id": 1, "method": "AcknowledgeChallenge.onRequestChallenge", "params": { "listen": true } } ``` Response: ``` { "id": 1, "result": { "listening": true, "event": "AcknowledgeChallenge.onRequestChallenge" } } ``` **Asynchronous event to initiate challenge()** Event Response: ``` { "id": 1, "result": { "correlationId": undefined, "parameters": { "capability": "xrn:firebolt:capability:localization::postal-code", "requestor": { "id": "ReferenceApp", "name": "Firebolt Reference App" } } } } ``` **App initiated response to event** Request: ``` { "id": 2, "method": "AcknowledgeChallenge.challengeResponse", "params": { "correlationId": undefined, "result": { "granted": true } } } ``` Response: ``` { "id": 2, "result": true } ``` ## Types ### GrantResult ``` type GrantResult = { granted: boolean } ``` --- ### ChallengeRequestor ``` type ChallengeRequestor = { id: string // The id of the app that requested the challenge name: string // The name of the app that requested the challenge } ``` --- ### Challenge ``` type Challenge = { capability: string // The capability that is being requested by the user to approve requestor: ChallengeRequestor // The identity of which app is requesting access to this capability } ``` See also: [ChallengeRequestor](/docs/150-manage-acknowledgechallenge#challengerequestor) --- ### ChallengeProviderRequest ``` type ChallengeProviderRequest = { parameters: Challenge // The result of the provider response. correlationId: string // The id that was passed in to the event that triggered a provider method to be called } ``` See also: [ProviderRequest](/docs/150-manage-Types-schemas#ProviderRequest) [Challenge](/docs/150-manage-acknowledgechallenge#challenge-1) ---