2

I want to upload images into SDL 8.0 under as multimedia schema component, here end point I am using is coreservice2015. As I execute the code, I am facing "Provided access token is invalid" issue. I tried few approach where I increased ExpiresAt() time, but still does not validate the token.

Any advice is welcomed. Below is snippet that calls and upload images

byte[] fd = new byte[(int) file.length()];
FileInputStream inStm = new FileInputStream(file);
DataInputStream dtstm = new DataInputStream(inStm);
dtstm.readFully(fd);
dtstm.close();
inStm.close();
IStreamUpload clientpub = coreService201501.getStreamUploadBasicHttp();
AccessTokenData td= coreService.getCurrentUser();
String icnPub = clientpub.uploadBinaryByteArray(td,fd);     
return icnPub;

Errors:

com.sdltridion.contentmanager.coreservice._201501.IStreamUploadUploadBinaryByteArrayCoreServiceFaultFaultFaultMessage: Provided access token is invalid.

1
  • Your question is really vague which might be due to the English you are using. I suggest you edit your question and review what it says and try to update it to make it more clear. – Bart Koopman Oct 9 '17 at 8:33
2

An Access Token contains a lot of claims about an (authenticated) user which are not supposed to be modified and which will expire after a while for security reasons.

To prevent tampering with Access Tokens, they are signed. If you try to modify any of the properties, the token no longer matches its signature and that will result in an "Provided access token is invalid" error. So, indeed, if you try to change the ExpireAt property, such an error is expected.

Are you sure you get the same error if you don't modify any of the Access Token properties? If so, can you check whether the Signature is set (td.getSignature()) ?

Or do you maybe get an "Provided access token has expired" error? In that case, can you check the value of the ExpireAt property?

1
  • Thanks for your valuable input Rick, answering your question 1. I am not tampering or modifying the access token value, I am just calling and assigning to clientpub.uploadBinaryByteArray(td,fd) as parameter 2. ttd.getSignature() retruns 117e9846830e13a9e1092823b16f4fee2ffe21dd680ebbc3abff486051f23f15 while ExpireAt is null , please advice – Jack Johnson Oct 11 '17 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.