Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Genarate Authorization Code

New post

Comments

3 comments

  • Alex Novotny

    Have you taken a look at the readme for the Java SDK? 

    https://github.com/box/box-java-sdk

    Alex, Box Developer Advocate

    0
    Comment actions Permalink
  • Boby Anju

    Hi Alex, thank you for the response. My requirement is create folder and upload file into Box using SDK or APIs. Actually I created folders and uploaded files into Box using both SDK and APIs. But I used developer token for that which we cannot be used in production.

    When I used the statement BoxDeveloperEditionAPIConnection api = BoxDeveloperEditionAPIConnection.getUserConnection("18958745833", boxConfig, accessTokenCache); in Java to get the connection I'm getting following error:

    Exception in thread "main" java.lang.NullPointerException
        at com.box.sdk.BoxDeveloperEditionAPIConnection.decryptPrivateKey(BoxDeveloperEditionAPIConnection.java:659)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.constructJWTAssertion(BoxDeveloperEditionAPIConnection.java:602)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.authenticate(BoxDeveloperEditionAPIConnection.java:431)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.tryRestoreUsingAccessTokenCache(BoxDeveloperEditionAPIConnection.java:571)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.getUserConnection(BoxDeveloperEditionAPIConnection.java:333)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.getAppUserConnection(BoxDeveloperEditionAPIConnection.java:310)
        at com.box.sdk.BoxDeveloperEditionAPIConnection.getUserConnection(BoxDeveloperEditionAPIConnection.java:396)
        at com.teknowmics.smartdocs.mavenproject2.AccessAsAppUser.main(AccessAsAppUser.java:48)

     

    The config json I used is :

    {
      "boxAppSettings": {
        "clientID": "06yxbqs7u75yce3ewxvk60pjy30xatfp",
        "clientSecret": "********************************",
        "appAuth": {
          "publicKeyID": "",
          "privateKey": "",
          "passphrase": ""
        }
      },
      "enterpriseID": "886081033"
    }

     

    Could you please suggest me what is wrong within my implementation, or an alternative solution?

    0
    Comment actions Permalink
  • Boby Anju

    Hi Alex its working fine now. I think the issue was on the config json the public and private key pair was not available. Thank you for your support. I expect your further assistance if I face any new issue.

    0
    Comment actions Permalink

Post is closed for comments.