@auth0-kits/server
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "@auth0-kits/server", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ const querystring = require('querystring'); | ||
const USER_URL = '/api/v2/users/'; | ||
const LINK_ACCOUNTS_URL = '/identities'; | ||
@@ -213,4 +214,33 @@ class Auth0Service { | ||
} | ||
async linkAccounts(primaryAccountUserId, secondaryToken) { | ||
this.tracer.trace('linkAccounts', { primaryAccountUserId, secondaryToken }); | ||
const body = querystring.stringify({ | ||
link_with: secondaryToken, | ||
}); | ||
this.tracer.crumb({ body }); | ||
let response; | ||
try { | ||
const url = `${this.auth0TenantUrl}${USER_URL}/${primaryAccountUserId}/${LINK_ACCOUNTS_URL}`; | ||
this.tracer.crumb({ url }); | ||
response = await fetch(url, { | ||
method: 'POST', | ||
body, | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
}); | ||
const { headers, status, statusText } = response; | ||
this.tracer.crumb({ headers, status, statusText }); | ||
} catch (error) { | ||
throw this.tracer.break(error); | ||
} | ||
const responseJson = await response.json(); | ||
return this.tracer.dump(responseJson); | ||
} | ||
} | ||
module.exports = Auth0Service; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8601
237
6