---
page_source: https://docs.juspay.io/upi-inapp/flutter/miscellaneous/session-expiry
page_title: Session Expiry
---


## Update Session Token



In some cases flow is needed to be continued even when signature expires, so it generates the need for communication between Juspay sdk and merchant to continue flow with new signature, provided by merchant. The solution to the above issue is providing a callback to the merchant, indicating signature expiry and requesting a new token.


###   Integration Changes


Merchant has to pass a new parameter in initiate request (or if a new auth token is generated for a process call then it will be required to be passed in the process call). The parameter authExpiry will take a string value and will indicate the initial signature/clientAuthToken expiry for the first token sent.

> **Note**
> Sample Payload`{ "action":"initiate"/"process",``"authExpiry": "2021-07-19T07:20:53.318Z",``"clientAuthToken" : "XXXXXXXXXXXXXXXX"``}`






###   Request for new ClientAuthToken


Input (Payload) Details


### Payload
- **RequestId**:
  - Description: Unique uuid-v4 string
  - Value: Example: abcd-12345-abcd-12345
  - Tags: String, Mandatory
- **Service**:
  - Description: Value: in.juspay.hyperapi
  - Tags: String, Mandatory
- **Payload**:
  - Description: Parameters required to call Hyper SDK API
  - Value:
    - **Action**:
      - Description: Operation to be performed in the SDK. Should be updateAuth for this call
      - Value: updateAuth
      - Tags: String, Mandatory
    - **ClientAuthToken**:
      - Description: ClientAuthToken
      - Tags: String, Mandatory
    - **AuthExpiry**:
      - Description: Default 15min (to extend functionality later if configuration to change signature expiry will be added)
      - Tags: Optional
    - **ReqCode**:
      - Description: Will be recieved in callback indication token expiry
      - Value: Example: abcde12345
      - Tags: String, Mandatory
  - Tags: JSON, Mandatory




#### Code Snippets: -

#### Flutter Code Snippet:

```flutter
{
  "requestId" : "1234567890",
  "service" : "in.juspay.hyperapi",
  "payload" : {
    "action" : "updateAuth",
    "clientAuthToken": "<clientAuthToken>",
    "authExpiry" : "2021-07-19T07:20:53.318Z",
    "requestCode" : "gdjhsdfgjhf-dsfyfsudgk"
  }
}
```



###   Request for new signature


Input (Payload) Details


### Payload
- **RequestId**:
  - Description: Unique uuid-v4 string
  - Value: Example: abcd-12345-abcd-12345
  - Tags: String, Mandatory
- **Service**:
  - Description: Value: in.juspay.hyperapi
  - Tags: String, Mandatory
- **Payload**:
  - Description: Parameters required to call Hyper SDK API
  - Value:
    - **Action**:
      - Description: Operation to be performed in the SDK. Should be updateAuth for this call
      - Value: updateAuth
      - Tags: String, Mandatory
    - **MerchantKeyId**:
      - Description: Key ID to identify the public-private key pair used for signature generation.
      - Value: Example: 1234
      - Tags: String, Mandatory
    - **Signature**:
      - Description: Signature generated for the signaturePayload.
      - Tags: String, Mandatory
    - **AuthExpiry**:
      - Description: Default 15min (to extend functionality later if configuration to change signature expiry will be added)
      - Tags: Optional
    - **ReqCode**:
      - Description: Will be recieved in callback indication token expiry
      - Value: Example: abcde12345
      - Tags: String, Mandatory
    - **SignaturePayload**:
      - Description: Signature payload is a stringified JSON of the details mentioned in the below table.
      - Value:
        - **Merchant_id**:
          - Description: Unique identifier associated with an account created by juspay.
          - Value: Example: stock
          - Tags: String, Mandatory
        - **Customer_id**:
          - Description: Any unique reference associated with your customer.
          - Value: Example: abcde12345
          - Tags: String, Mandatory
        - **Timestamp**:
          - Description: Time when request is created in milliseconds.
          - Value: Example: 1665996901100
          - Tags: String, Mandatory
      - Tags: String, Mandatory
  - Tags: JSON, Mandatory




#### Code Snippets: -

#### Flutter Code Snippet:

```flutter
{
  "requestId" : "1234567890",
  "service" : "in.juspay.hyperapi",
  "payload" : {
    "action" : "updateAuth",
    "signature": "<Generated signature for signature payload>",
    "signaturePayload": "<Stringified signature payload>",
    "merchantKeyId" : "1234",
    "authExpiry" : "2021-07-19T07:20:53.318Z",
    "requestCode" : "gdjhsdfgjhf-dsfyfsudgk"
  }
}

"signaturePayload": {
  "merchant_id": "stock",
  "customer_id": "abcde12345",
  "timestamp": "1668389349848"
}
```



###   Callback Indicating Token Expiry


This event is given when clientAuthToken/signature expires. This event will be received by merchant under `onEvent` callbacks from Juspay's SDK with the event name `session_expired` and a `reqCode`.

> **Note**
> `{ "event":"session_expired",``"payload":``{ "timestamp": "2021-07-19T07:20:53.318Z",``"reqCode" : "gdjhsdfgjhf-dsfyfsudgk"``}``}`



