OAUTH_SCOPE_MISMATCH error when trying to use getRecords

OAUTH_SCOPE_MISMATCH error when trying to use getRecords

Hi team,

I'm trying to use getRecords method, but always getting OAUTH_SCOPE_MISMATCH. I tried different scopes when creating Grant token in Self Client.

Here are my steps:
1. Added Self Client in https://api-console.zoho.com/ and tried the following scopes: ZohoCRM.settings.ALL, ZohoCRM.modules.contacts.all, ZohoCRM.modules.all, ZohoCRM.org.ALL.
2. When I got Grant token I sent a POST request to https://accounts.zoho.com/oauth/v2/token with the following parameters: code - my grant access code, client_id - my client ID, client_secret - my client secret, grant_type - authorization_code, redirect_uri - http://localhost/zohocrm/
3. I've got a response from the previous request:
{
    "access_token": "1000.3***c.b***9",
    "refresh_token": "1000.6***e.0***8",
    "api_domain": "https://www.zohoapis.com",
    "token_type": "Bearer",
    "expires_in": 3600
}
4. Then I'm using the following PHP code:

  1. <?php

    use com\zoho\api\authenticator\OAuthBuilder;
    use com\zoho\api\authenticator\store\FileStore;
    use com\zoho\crm\api\InitializeBuilder;
    use com\zoho\crm\api\UserSignature;
    use com\zoho\crm\api\dc\USDataCenter;
    use com\zoho\crm\api\record\RecordOperations;
    use com\zoho\crm\api\HeaderMap;
    use com\zoho\crm\api\ParameterMap;
    use com\zoho\crm\api\record\GetRecordsHeader;
    use com\zoho\crm\api\record\GetRecordsParam;
    use com\zoho\crm\api\record\ResponseWrapper;
    require_once 'vendor/autoload.php';

    class Record
    {
        public function initialize()
        {
            $user = new UserSignature("admin@***p.com");
            $environment = USDataCenter::PRODUCTION();
            $token = (new OAuthBuilder())
                ->clientId("1000.*****")
                ->clientSecret("*****")
                ->refreshToken("1000.*****.*****")
                ->redirectURL("http://localhost/zohocrm/")
                ->build();

            $tokenstore = new FileStore(__DIR__."/php_sdk_token.txt");
            (new InitializeBuilder())
                ->user($user)
                ->environment($environment)
                ->token($token)
                ->store($tokenstore)
                ->initialize();
        }

        public function getRecord()
        {
            try {
                $recordOperations = new RecordOperations();
                $paramInstance = new ParameterMap();
                $paramInstance->add(GetRecordsParam::approved(), "both");
                $headerInstance = new HeaderMap();
                $ifmodifiedsince = date_create("2020-06-02T11:03:06+05:30")->setTimezone(new \DateTimeZone(date_default_timezone_get()));
                $headerInstance->add(GetRecordsHeader::IfModifiedSince(), $ifmodifiedsince);
                $moduleAPIName = "Contacts";
                $response = $recordOperations->getRecords($moduleAPIName, $paramInstance, $headerInstance);
                if($response != null)            {
                    echo("Status Code: " . $response->getStatusCode() . "\n");
                    $responseHandler = $response->getObject();
                    if($responseHandler instanceof ResponseWrapper)                {
                        $responseWrapper = $responseHandler;
                        $records = $responseWrapper->getData();
                        if($records != null)                    {
                            $recordClass = 'com\zoho\crm\api\record\Record';
                            foreach($records as $record)                        {
                                echo("Record ID: " . $record->getId() . "\n");
                                $createdBy = $record->getCreatedBy();
                                if($createdBy != null)                            {
                                    echo("Record Created By User-ID: " . $createdBy->getId() . "\n");
                                    echo("Record Created By User-Name: " . $createdBy->getName() . "\n");
                                    echo("Record Created By User-Email: " . $createdBy->getEmail() . "\n");
                                }
                                echo("Record CreatedTime: ");
                                print_r($record->getCreatedTime());
                                echo("\n");
                                $modifiedBy = $record->getModifiedBy();
                                if($modifiedBy != null)                            {
                                    echo("Record Modified By User-ID: " . $modifiedBy->getId() . "\n");
                                    echo("Record Modified By User-Name: " . $modifiedBy->getName() . "\n");
                                    echo("Record Modified By User-Email: " . $modifiedBy->getEmail() . "\n");
                                }
                                echo("Record ModifiedTime: ");
                                print_r($record->getModifiedTime());
                                print_r("\n");
                                $tags = $record->getTag();
                                if($tags != null)                            {
                                    foreach($tags as $tag)                                {
                                        echo("Record Tag Name: " . $tag->getName() . "\n");
                                        echo("Record Tag ID: " . $tag->getId() . "\n");
                                    }
                                }
                                echo("Record Field Value: " . $record->getKeyValue("Last_Name") . "\n");
                                echo("Record KeyValues : \n" );
                                foreach($record->getKeyValues() as $keyName => $value)                            {
                                    echo("Field APIName" . $keyName . " \tValue : ");
                                    print_r($value);
                                    echo("\n");
                                }
                            }
                        }
                    }
                }
            }
            catch (\Exception $e) {
                print_r($e);
            }
        }
    }

    $obj = new Record();
    $obj->initialize();
    $obj->getRecord();

    ?>

But I'm always getting OAUTH_SCOPE_MISMATCH error. What I'm doing wrong? Can you help me please?