I'm creating users and issuing grants to them. I have a limitation with token exchange since these users belong to a different ownerAccount.
I'm doing something similar to what is described here https://developers.tapkey.io/mobile/embedded/getting_started/#creating-a-user but on a server and not mobile.
My challenge is that the ownerAccount to which the user should be created (the one which has the lock for which I want to make grants is different from my account(which has the identity provider) so I get an error, is it possible to create users using authorization code
as a mode of authentication?
try {
const user = await axios.put(
`${this.baseUrl}/owners/${this.ownerAccountId}/identityproviders/${this.provider}/users`,
{
'ipUserId': details.userId
},
{
headers: {
'Authorization': `Bearer ${token}`
}
}
)
// create a new contact for the user created above
const contact = await this.createContactForUser(token, user.data.ipUserId)
// create grant for contact created above
await this.createGrantForContact(token, contact.id, details.lockId)
return user.data.ipUserId