title: Firebase Java admin SDK error
body: <p>I am trying to verify ID Token of user. Whenever I call the verifyIdToken function the following error is thrown:</p>
  
  <blockquote>
    <p>java.lang.IllegalArgumentException: projectId must be set</p>
  </blockquote>
  
  <p>Here is the servlet code:</p>
  
  <pre><code>public class GeneratorInfoServlet extends HttpServlet {
      FirebaseApp app = null;
  
      @Override
      public void init(ServletConfig config) {
          InputStream serviceAccount = Thread.currentThread().getContextClassLoader()
                  .getResourceAsStream("/WEB-INF/service_key.json");
  
          FirebaseOptions options = new FirebaseOptions.Builder()
                  .setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
                  .setDatabaseUrl("https://project-id.firebaseio.com/")
                  .build();
  
          this.app = FirebaseApp.initializeApp(options);
  
      }
  
      @Override
      protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          PrintWriter out = resp.getWriter();
          StringBuffer tokenBuffer = new StringBuffer();
          String line;
  
          try {
              BufferedReader reader = req.getReader();
              while ((line = reader.readLine()) != null)
                  tokenBuffer.append(line);
  
              this.verifyToken(tokenBuffer.toString());
              out.print("{'success': false}");
          } catch (Exception e) {
              System.err.print(e);
              out.print("{'success': true}");
          }
      }
  
      private void verifyToken(String idToken) {
          System.out.println(app);
          FirebaseAuth.getInstance(this.app).verifyIdToken(idToken)
                  .addOnSuccessListener(decodedToken -&gt; {
                      String uid = decodedToken.getUid();
                      System.out.println(uid);
                  }).addOnFailureListener(e -&gt; System.out.println(e));
      }
  }
  </code></pre>
  
  <p>I've been going through documentation and I didn't find a way how to set the project id directly. However I think it shouldn't be necessary in the first place since it's already written in the service_key and database url.</p>
  
  <p>Thanks!</p>
  
  <p>Edit:</p>
  
  <p>Regular Java SDK (non admin) has setApplicationId("PROJECT_ID") function built in FirebaseOptions builder. However there is no such option in Admin SDK</p>