How to get one time URL when we are writing hook_mail_alter? My Question is already present here but the previously given answer for my question can applied to Drupal 7 and I can not use the same solution in Drupal 8.

I hope it is okay not put the same question once again.
Bingo! Found the Solution myself:

    function custom_module_mail_alter(&amp;$message) {
      if (!empty($message['id']) &amp;&amp; $message['id'] == 'user_password_reset') {
        $token_service = \Drupal::token();
        $language_interface = \Drupal::languageManager()-&gt;getCurrentLanguage();
        $account = $message['params']['account'];  
        $one_time_url_token = '[user:one-time-login-url]';  
        $one_time_url = $token_service-&gt;replace($one_time_url_token, ['user' =&gt; $account], ['langcode' =&gt; $language_interface-&gt;getId(), 'callback' =&gt; 'user_mail_tokens', 'clear' =&gt; TRUE]);  
      }
    }