Genarate Authorization Code
I've created two Apps in developer console. One with JWT authentication type and the second one with Auth 2 type. In both cases I cannot generate the Authorization Code in order to call the Get Token API. I want to integrate with Java. Could you please suggest a solution?
-
Have you taken a look at the readme for the Java SDK?
https://github.com/box/box-java-sdk
Alex, Box Developer Advocate
-
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?
Post is closed for comments.
Comments
3 comments