title: Using async await firebase storage
body: <p>I need to wait for the file to be uploaded before taking any action.</p>
  
  <p>I developed the following code but I can not get <code>downloadURL</code>;</p>
  
  <p>I want to get <code>downloadURL</code> using async method to have a good code.</p>
  
  <p>I checked and there is no error while uploading the image, since the image is uploading normally but I can not get <code>downloadURL</code> after upload.</p>
  
  <p><strong>auth.service.ts</strong></p>
  
  <pre><code>async changeUserAvatar(avatar: any): Promise&lt;firebase.storage.UploadTaskSnapshot&gt; {
      try {
          let storageRef = firebase.storage().ref();
          return await storageRef.child(`avatars/${this.userLogged.uid}`).put(avatar);
      } catch (error) {
          alert(error);
      }
  }
  </code></pre>
  
  <p><strong>my-component.ts</strong></p>
  
  <pre><code>saveUser(): void {
      this.chekcUserAdmin()
          .pipe(takeUntil(this._unsubscribeAll))
          .subscribe(async (user: any) =&gt; {
              if (!user.admin) {
  
                  const upload = await this._authService.changeUserAvatar(this.avatarUpload);
  
                  // #FIX-ME
                  // The upload.downloadURL here is coming undefined;
                  user.avatar = upload.downloadURL; 
                  await this.updateUser(user);
  
                  alert('User saved!');
              }
          });
  }
  </code></pre>