Within Rules, you can check context.stats.loginsCount===1
and i.e. add a custom claim to your ID token to handle it accordingly on your client side.
For example:
function (user, context, callback) {
const namespace = 'https://myapp.example.com/';
context.idToken[namespace + 'is_new'] = (context.stats.loginsCount === 1);
callback(null, user, context);
}
Similar threads in this forum: