title: custom login for firebase in swift
body: <p>I have to implement a chat platform using firebase and swift.</p>
  
  <p>I know how to create a user using emailid :</p>
  
  <pre><code>    firebase.createUser(emailTextField, password: passwordTextField.text) { (error:NSError!) -&gt; Void in
          if (error != nil){
              print(error.localizedDescription)
              self.displayMessage(error)
          } else{
              print("New user created")
              self.requestUsername()
          }
      }
  </code></pre>
  
  <p>But I am not taking any email id or other accounts. I want to create a custom user. For that they have mentioned to use the secure JWT Token and then use this : </p>
  
  <pre><code>    let ref = Firebase(url: "https://&lt;YOUR-FIREBASE-APP&gt;.firebaseio.com/")
  ref.authWithCustomToken(AUTH_TOKEN, withCompletionBlock: { error, authData in
      if error != nil {
          println("Login failed! \(error)")
      } else {
          println("Login succeeded! \(authData)")
      }
  })
  </code></pre>
  
  <p>But they have not mentioned how to generate secure JWT Token in swift. 
  Anyone know?</p>
  
  <p>Here is the link i referred:
  <a href="https://www.firebase.com/docs/ios/guide/login/custom.html" rel="nofollow">How to login in firebase</a></p>