box api - OpenSSL unable to verify data: error:0906D06C:PEM routines:PEM_read_bio:no start line in Box API -


im getting above error when sending following body box oauth /token operation: grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&client_id=.............&client_secret=..........&assertion=eyjhbgcioijsuzi1niisinr5cci6ikpxvcisimtpzci6im81ngftcgr6in0=.eyjpc3mioiiyohrhzmz0ejhlenhncni3atbocmznmgltetc2mjrumyisinn1yii6iju0mja5msisimjvef9zdwjfdhlwzsi6imvudgvychjpc2uilcjhdwqioijodhrwczovl2fwas5ib3guy29tl29hdxromi90b2tlbiisimp0asi6ije0ndyymza3mtgxmjm0ntyilcjlehaioje0ndyymza3njgsimlhdci6mtq0njizmdcxoh0=.anwpzohhfyumpmw1wh6km8xzqsuans3uidepn40hvpvdmzi9ws0ftpmxwvudgppxxmee0cr+frbmx+r9v9dvzfjsgv2+mu1bqwsjhwpkoy06iigavgijppft9cuidmy/h6pgtdpodfeau77krt0ojhpqx9he4xy0mas26d7yc/5f3fyxzxhdg/xztpx88xtpg2hbej5imezjxkff6zh4un0zy9tj3tseittcqrxhaun2qattnx8h5jmkwyte5u78+f1lzqz1lpjnqsj/bsrcrf2jkf7n0lfjwq3u1bxnbwiezrw8wqvatvzlpioddsl6vug/xs1m549wgvwyxcgljq==

now jwt, of assertion parameter, verifies correctly @ jwt.io, , public key defined box verifies in box ui @ jwt.io.

this indicates me i'm sending correct.

however box has issue..... received!

the problem seems in public , private key generated using openssl in dos command prompt.

you can follow instructions in link: https://box-content.readme.io/docs/app-auth

first of all, have download cygwin tool: http://www.cygwin.com/

then, in cygwin console can launch following commands:

for private key

openssl genrsa -aes256 -out private_key.pem 2048 

for public key

openssl rsa -pubout -in private_key.pem -out public_key.pem 

be sure include full header , footer: '-----begin public key-----' , '-----end public key-----'

once you've generated public key, need add in app's configuration. when finished you'll public key id.

you should able connect keys using box api.

var privatekey = file.readalltext("private_key.pem");  var boxconfig = new boxconfig(client_id, client_secret, enterprise_id, privatekey, jwt_private_key_password, jwt_public_key_id); var boxjwt = new boxjwtauth(boxconfig);  var admintoken = boxjwt.admintoken(); console.writeline("admin token: " + admintoken); 

i hope you


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -