@@ -2277,24 +2277,34 @@ void tokenRefreshOptOutBeforeLogin(boolean useV4Uid, boolean useRefreshedV4Uid,
22772277 @ ValueSource (strings = {"text/plain" , "application/octet-stream" })
22782278 void tokenValidateWithEmail_Mismatch (String contentType , Vertx vertx , VertxTestContext testContext ) {
22792279 final int clientSiteId = 201 ;
2280+ final String phone = ValidateIdentityForPhone ;
22802281 final String emailAddress = ValidateIdentityForEmail ;
22812282 fakeAuth (clientSiteId , Role .GENERATOR );
22822283 setupSalts ();
22832284 setupKeys ();
22842285
2285- send (vertx , "v2/token/validate" , new JsonObject ().put ("token" , "abcdef" ).put ("email" , emailAddress ),
2286- 400 ,
2287- respJson -> {
2288- assertEquals ("client_error" , respJson .getString ("status" ));
2289- assertEquals ("Invalid token" , respJson .getString ("message" ));
2286+ generateTokens (vertx , "phone" , phone , genRespJson -> {
2287+ assertEquals ("success" , genRespJson .getString ("status" ));
2288+ JsonObject genBody = genRespJson .getJsonObject ("body" );
2289+ assertNotNull (genBody );
22902290
2291- testContext .completeNow ();
2292- },
2293- Map .of (HttpHeaders .CONTENT_TYPE .toString (), contentType ));
2291+ String advertisingTokenString = genBody .getString ("advertising_token" );
2292+
2293+ JsonObject v2Payload = new JsonObject ();
2294+ v2Payload .put ("token" , advertisingTokenString );
2295+ v2Payload .put ("email" , emailAddress );
2296+
2297+ send (vertx , "v2/token/validate" , v2Payload , 200 , json -> {
2298+ assertFalse (json .getBoolean ("body" ));
2299+ assertEquals ("success" , json .getString ("status" ));
2300+
2301+ testContext .completeNow ();
2302+ });
2303+ });
22942304 }
22952305
22962306 @ Test
2297- void tokenValidateWithEmailHash_Mismatch (Vertx vertx , VertxTestContext testContext ) {
2307+ void tokenValidateWithInvalidToken (Vertx vertx , VertxTestContext testContext ) {
22982308 final int clientSiteId = 201 ;
22992309 fakeAuth (clientSiteId , Role .GENERATOR );
23002310 setupSalts ();
0 commit comments