0
votes

I am completelly new to OAuth2 and I would like to get this example working before I move to integrate OAuth2 with my application. What I have done is the following:

  1. cd [someDirectory]
  2. hg clone https://code.google.com/p/google-api-java-client.samples/ google-api-java-client-samples
  3. cd google-api-java-client-samples/oauth2-cmdline-ample
  4. cp ~/Downloads/client_secrets.json src/main/resources/client_secrets.json
  5. mvn compile
  6. mvn -q exec:java

This is the error I am getting while executing this code:

java.lang.NullPointerException at com.google.api.services.samples.oauth2.cmdline.OAuth2Sample.authorize(OAuth2Sample.java:81) at com.google.api.services.samples.oauth2.cmdline.OAuth2Sample.main(OAuth2Sample.java:100) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:290) at java.lang.Thread.run(Thread.java:662)

1

1 Answers

0
votes

Can you check your classes folder after step #5? The classes folder should have your client_secrets.json. It should not have "Enter Client ID" etc.

Looking at the stack trace, it seems the application is not able to find client_id in the client_secrets.json and hence failing with NPE.