Closed severinstampler closed 2 years ago
create automatically on login if not existing
An API is available for DID creation and registration. For EBSI, it requires a bearer token to be given as a form parameter "ebsiBearerToken", see details: createDid API
If a did of that method already exists, it will return an error 400. Use listDids to list existing dids.
@severinstampler I am working to integrate the API for create a did for EBSI and I don't know if the "token" that user fill in "Your token ebsiBearerToken that need be sent to create it in /api/wallet/did/create
yes it needs to be sent in order to register the did on EBSI.
is any ebsiBearerToken for testing available to get the success data formats
Hi, yes, you have to go to https://app.preprod.ebsi.eu/users-onboarding/ click "onboard with captcha", "Desktop wallet". It will show a token, that's valid for 15 minutes.
I don't know if the exact schema for post, but i did
axios.post('/api/wallet/did/create?method=ebsi', {
header:{
"Content-Type": "application/x-www-form-urlencoded"
},
data:{
"ebsiBearerToken": ${this.token}
}
})
axios.post('/api/wallet/did/create?method=ebsi', { header:{ "Content-Type": "application/x-www-form-urlencoded" }, data:{ "ebsiBearerToken":
${this.token} } })
this endoint is currently implemented to accept form data, like it is produced when submitting an HTML form. however, on second thought, I could also make it accept a data object, like you implemented it.
well, to support the form data body, just pass the key-value pair in plain text, like:
"ebsiBearerToken=${this.token}"
cheers
Hello @severinstampler, I don't know but this still gives us "400 error", please check if the format I use is correct because it took it same as used in cURL in the API Documentation, I see need to tell me the exact format because that currently in doc, also if need authorisation in header or not
async tokenSubmit (){
try{
const data = await this.$axios.$post('/api/wallet/did/create?method=ebsi', {
header:{
"accept": "text/plain",
"Content-Type": "application/x-www-form-urlencoded"
},
data:{
ebsiBearerToken:`${this.token}`,
}
})
console.log(data.data)
this.tokenSubmitted=true
this.wizardIndex = this.wizardIndex+1
}catch(e){
console.warn(e)
this.tokenWrong=true
}
}
Hi @iietmoon, like I described in my previous comment, the key-value pair should be given in plain text in the post body.
You are passing it as a JSON object, however, the right way would be just like this:
"ebsiBearerToken=${this.token}"
Alternatively, you can use the FormData object to pass the data, like described here: https://blog.digital-craftsman.de/send-form-data-with-axios-vue-js/
Regarding authorization: You don't have to care about it, as it is automatically handled by the auth plugin.
@iietmoon, I adapted the DID creation API and already changed the API call in the vue component. It seems to work now.
Provide functionality to create DID from wallet.