Latest Legacy

Validate a session

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Verify/Session/{session_uuid}/

Arguments

otp string

The OTP that you want to validate against a particular session.

Returns

Returns a JSON response containing the API request ID and session UUID.

Response

{
    "api_id": "e7af31b5-a7cb-40d6-a3ab-122fdcc9f0fe",
    "message": "session validated successfully.",
}

Example Request

1
2
3
4
5
6
7
8
9
10
11
import sys
sys.path.append("../plivo-python")
import plivo

client = plivo.RestClient('<auth_id>','<auth_token>')

response = client.verify_session.validate(
        session_uuid = '<session uuid>',
        otp='<otp value>')

print(response)
1
2
3
4
5
6
7
let plivo = require('plivo')
let client = new plivo.Client('<auth_id>', '<auth_token>');
client.verify_session.validate({id:'<session_uuid>',otp:'<otp>'}).then(function(response) {
console.log(response)
}).catch(function (error) {
console.log(error)
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require '/usr/src/app/vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoResponseException;

// ENVIRONMENT
$client = new RestClient("<auth_id>", "<auth_token>");


//Validate Session
try {
$response1 = $client->verifySessions->validate(
'<session_uuid>',
'<otp>'
);
print_r($response1);
}
catch (Exception $ex) {
print_r($ex);
}
?>
1
2
3
4
5
6
curl -i --user auth_id:auth_token \
    -H "Content-Type: application/json" \
    -d '{ 
    "OTP": "<otp>"
}' \
    https://api.plivo.com/v1/Account/{auth_id}/Verify/Session/{session_uuid}/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main

import (
        "fmt"
        "encoding/json"

        "github.com/plivo/plivo-go"
)

func main() {
client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
if err != nil {
fmt.Printf("Error:\n", err)
}

        //Validate
        response_validate, err := client.VerifySession.Validate(
                plivo.SessionValidationParams{
                        OTP: "<otp value>",
                }, "<SessionUUID>",
        )
        if err != nil {
                fmt.Print("Error", err.Error())
                return
        }
        res3, _ := json.Marshal(response_validate)
        fmt.Printf("Response Validation: \n\n %#v \n", string(res3))
}