Server-side verification
Stay organized with collections
Save and categorize content based on your preferences.
Page Summary
Server-side verification callbacks are URL requests sent by Google to external systems to notify them that a user should be rewarded for interacting with a rewarded or rewarded interstitial ad, providing extra protection against spoofing.
This guide explains how to verify rewarded server-side verification callbacks using the Tink Java Apps library or any other third-party library that supports ECDSA.
Rewarded SSV callbacks include several query parameters describing the ad interaction, such as ad_network, ad_unit, reward_amount, reward_item, and a unique transaction_id.
To verify a callback, you need to fetch and parse public keys from the AdMob key server, extract the content to be verified, the signature, and the key_id from the callback URL, and then use the appropriate public key to verify the signature.
For a good user experience, it is recommended to reward the user immediately using the client-side callback while performing validation on all rewards upon receiving server-side callbacks.
Server-side verification callbacks are URL requests, with query parameters
expanded by Google, that are sent by Google to an external system to
notify it that a user should be rewarded for interacting with a rewarded or
rewarded interstitial ad. Rewarded SSV (server-side verification) callbacks
provide an extra layer of protection against spoofing of client-side callbacks
to reward users.
This guide shows you how to verify rewarded SSV callbacks by using the
Tink Java Apps third-party
cryptographic library to ensure that the query parameters in the callback are
legitimate values.
Although Tink is used for the purposes of this guide, you have the option to
use any third-party library that supports
ECDSA.
You can also test your server with the testing
tool in the AdMob UI.
Use RewardedAdsVerifier from the Tink Java Apps library
The Tink Java Apps GitHub repository
includes a
RewardedAdsVerifier
helper class to reduce the code required to verify a rewarded SSV callback.
Using this class enables you to verify a callback URL with the following code.
If the verify() method executes without raising an exception, the callback
URL was successfully verified. The Rewarding the user
section details best practices regarding when users should be rewarded. For a
breakdown of the steps performed by this class to verify rewarded SSV callbacks,
you can read through the Manual verification of rewarded
SSV section.
SSV callback parameters
Server-side verification callbacks contain query parameters that describe the
rewarded ad interaction. Parameter names, descriptions, and example values are
listed below. Parameters are sent in alphabetical order.
Parameter Name
Description
Example value
ad_network
Ad source identifier for the ad source that fulfilled this ad. Ad source
names corresponding to ID values are listed in the Ad
source identifiers section.
1953547073528090325
ad_unit
AdMob ad unit ID that was used to request the rewarded ad.
* Prior to May 1, 2024, this network was called "UnrulyX".
2831998725945605450
OneTag Exchange (bidding)
4873891452523427499
OpenX (bidding)
4918705482605678398
Pangle
4069896914521993236
Pangle (bidding)
3525379893916449117
PubMatic (bidding)
3841544486172445473
Reservation campaign
7068401028668408324
SK planet
734341340207269415
Sharethrough (bidding)
5247944089976324188
Smaato (bidding)
3362360112145450544
Sonobi (bidding)
3270984106996027150
Tapjoy
7295217276740746030
Tapjoy (bidding)
4692500501762622178
Tencent GDT
7007906637038700218
TripleLift (bidding)
8332676245392738510
Unity Ads
4970775877303683148
Unity Ads (bidding)
7069338991535737586
Verve Group (bidding)
5013176581647059185
Vpon
1940957084538325905
Yieldmo (bidding)
4193081836471107579
YieldOne (bidding)
3154533971590234104
Zucks
5506531810221735863
Rewarding the user
It is important to balance user experience and reward validation when deciding
when to reward a user. Server-side callbacks may experience delays before
reaching external systems. Therefore, the recommended best practice is to use
the client-side callback to reward the user immediately, while performing
validation on all rewards upon the receipt of server-side callbacks. This
approach provides a good user experience while ensuring the validity of granted
rewards.
However, for applications where reward validity is critical (for example, the
reward affects your app's in-game economy) and delays in granting rewards are
acceptable, waiting for the verified server-side callback may be the best
approach.
Custom data
Apps that require extra data in server-side verification callbacks should use
the custom data feature of rewarded ads. Any string value set on a rewarded ad
object is passed to the custom_data query parameter of the SSV callback. If no
custom data value is set, the custom_data query parameter value won't be
present in the SSV callback.
The following example sets the SSV options after the rewarded ad is loaded:
The steps performed by the RewardedAdsVerifier class to verify a rewarded
SSV are outlined below. Although the included code snippets are in Java and
leverage the Tink third-party library, these steps can be implemented by you in
the language of your choice, using any third-party library that supports
ECDSA.
Fetch public keys
To verify a rewarded SSV callback, you need a public key provided by AdMob.
A list of public keys to be used to validate the rewarded SSV callbacks can be
fetched from the AdMob key
server. The list of public keys
is provided as a JSON representation with a format similar to the following:
{"keys":[{keyId:1916455855,pem:"-----BEGIN PUBLIC KEY-----\nMF...YTPcw==\n-----END PUBLIC KEY-----"base64:"MFkwEwYHKoZIzj0CAQYI...ltS4nzc9yjmhgVQOlmSS6unqvN9t8sqajRTPcw=="},{keyId:3901585526,pem:"-----BEGIN PUBLIC KEY-----\nMF...aDUsw==\n-----END PUBLIC KEY-----"base64:"MFYwEAYHKoZIzj0CAQYF...4akdWbWDCUrMMGIV27/3/e7UuKSEonjGvaDUsw=="},],}
To retrieve the public keys, connect to the AdMob key server and download the
keys. The following code accomplishes this task and saves the JSON
representation of the keys to the data variable.
String url = ...;
NetHttpTransport httpTransport = new NetHttpTransport.Builder().build();
HttpRequest httpRequest =
httpTransport.createRequestFactory().buildGetRequest(new GenericUrl(url));
HttpResponse httpResponse = httpRequest.execute();
if (httpResponse.getStatusCode() != HttpStatusCodes.STATUS_CODE_OK) {
throw new IOException("Unexpected status code = " + httpResponse.getStatusCode());
}
String data;
InputStream contentStream = httpResponse.getContent();
try {
InputStreamReader reader = new InputStreamReader(contentStream, UTF_8);
data = readerToString(reader);
} finally {
contentStream.close();
}
Note that public keys are regularly rotated. You will receive an email to inform
you of an upcoming rotation. If you're caching public keys, you should update
the keys upon receiving this email.
Once the public keys have been fetched, they must be parsed. The
parsePublicKeysJson method below takes a JSON string, such as the example
above, as input, and creates a mapping from key_id values to public keys,
which are encapsulated as ECPublicKey objects from the Tink library.
private static Map<Integer, ECPublicKey> parsePublicKeysJson(String publicKeysJson)
throws GeneralSecurityException {
Map<Integer, ECPublicKey> publicKeys = new HashMap<>();
try {
JSONArray keys = new JSONObject(publicKeysJson).getJSONArray("keys");
for (int i = 0; i < keys.length(); i++) {
JSONObject key = keys.getJSONObject(i);
publicKeys.put(
key.getInt("keyId"),
EllipticCurves.getEcPublicKey(Base64.decode(key.getString("base64"))));
}
} catch (JSONException e) {
throw new GeneralSecurityException("failed to extract trusted signing public keys", e);
}
if (publicKeys.isEmpty()) {
throw new GeneralSecurityException("No trusted keys are available.");
}
return publicKeys;
}
Get content to be verified
The last two query parameters of rewarded SSV callbacks are always signature
and key_id, in that order. The remaining query parameters specify the content
to be verified. Let's assume you configured AdMob to send reward callbacks to
https://www.myserver.com/mypath. The snippet below shows an example rewarded
SSV callback with the content to be verified highlighted.
The code below demonstrates how to parse the content to be verified from a
callback URL as a UTF-8 byte array.
public static final String SIGNATURE_PARAM_NAME = "signature=";
...
URI uri;
try {
uri = new URI(rewardUrl);
} catch (URISyntaxException ex) {
throw new GeneralSecurityException(ex);
}
String queryString = uri.getQuery();
int i = queryString.indexOf(SIGNATURE_PARAM_NAME);
if (i == -1) {
throw new GeneralSecurityException("needs a signature query parameter");
}
byte[] queryParamContentData =
queryString
.substring(0, i - 1)
// i - 1 instead of i because of & in the query string
.getBytes(Charset.forName("UTF-8"));
Get signature and key_id from callback URL
Using the queryString value from the previous step, parse the signature and
key_id query parameters from the callback URL as shown below:
public static final String KEY_ID_PARAM_NAME = "key_id=";
...
String sigAndKeyId = queryString.substring(i);
i = sigAndKeyId.indexOf(KEY_ID_PARAM_NAME);
if (i == -1) {
throw new GeneralSecurityException("needs a key_id query parameter");
}
String sig =
sigAndKeyId.substring(
SIGNATURE_PARAM_NAME.length(), i - 1 /* i - 1 instead of i because of & */);
int keyId = Integer.valueOf(sigAndKeyId.substring(i + KEY_ID_PARAM_NAME.length()));
Perform verification
The final step is to verify the content of the callback URL with the
appropriate public key. Take the mapping returned from the
parsePublicKeysJson method and use the key_id parameter from the callback
URL to get the public key from that mapping. Then verify the signature with
that public key. These steps are demonstrated below in the verify method.
If the method executes without throwing an exception, the callback URL was
successfully verified.
FAQ
Can I cache the public key provided by the AdMob key server?
We recommend that you cache the public key provided by the AdMob key
server to reduce the number of operations required to validate SSV
callbacks. However, note that public keys are regularly rotated and should not
be cached for longer than 24 hours.
How frequently are the public keys provided by the AdMob key server rotated?
Public keys provided by the AdMob key server are rotated on a variable
schedule. To ensure that verification of SSV callbacks continues to work as
intended, public keys should not be cached for longer than 24 hours.
What happens if my server can't be reached?
Google expects an HTTP 200 OK success status response code for SSV
callbacks. If your server cannot be reached or does not provide the expected
response, Google will re-attempt to send SSV callbacks up to five times in
one-second intervals.
How can I verify that SSV callbacks are coming from Google?
Use reverse DNS lookup to verify that SSV callbacks originate from Google.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-06-12 UTC."],[],["Server-Side Verification (SSV) callbacks confirm user rewards for ad interactions, enhancing security. AdMob sends requests with parameters like `ad_network`, `ad_unit`, `reward_amount`, `signature`, and more. The `RewardedAdsVerifier` class or manual verification is used, with these steps: fetch public keys from AdMob's server, extract and verify the callback's signature using the designated `key_id`, and confirm that no parameter was modified. The order of parameters must be kept, and public keys should be updated regularly. An `HTTP 200 OK` response is expected for successful verification. Reverse DNS Lookup can be used to verify the source of the callback.\n"]]