title: How to get FCM Token when user has denied access to allow notifications
body: <p>This is my first time working on with firebase due to a requirement by the backend so let me know if you don't understand the question or if it doesn't make any sense. <br /><br />What I want to achieve is that I need a <code>Registration_ID</code> which is the FCM Token when user register. So this is how I'm implementing it in <code>AppDelegate.swift</code> > <code>didFinishLaunchingWithOptions</code></p>
  
  <pre><code>if #available(iOS 10.0, *) {
              // For iOS 10 display notification (sent via APNS)
              UNUserNotificationCenter.current().delegate = self
  
              let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
              UNUserNotificationCenter.current().requestAuthorization(
                  options: authOptions,
                  completionHandler: {_, _ in })
          } else {
              let settings: UIUserNotificationSettings =
                  UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
              application.registerUserNotificationSettings(settings)
          }
  
          application.registerForRemoteNotifications()
  </code></pre>
  
  <p>After that in <code>AppDelegate.swift</code> I've added these three functions:</p>
  
  <pre><code>func application(_ application: UIApplication,
                       didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
          Messaging.messaging().apnsToken = deviceToken as Data
      }
  
      func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) {
          print("Firebase registration token: \(fcmToken)")
      }
  
      func application(application: UIApplication,
                       didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
          Messaging.messaging().apnsToken = deviceToken as Data
      }
  </code></pre>
  
  <p>No the issue is that when it ask for permission of notification and user deny it then how I'll get FCM that I'll send to the backend when user register or login.</p>