@workos-inc/node
Advanced tools
Comparing version 2.16.0 to 2.17.0
@@ -11,2 +11,3 @@ import { ConnectionType } from './connection-type.enum'; | ||
last_name?: string; | ||
groups?: string[]; | ||
raw_attributes?: { | ||
@@ -13,0 +14,0 @@ [key: string]: any; |
@@ -161,2 +161,3 @@ "use strict"; | ||
last_name: 'bar', | ||
groups: ['Admins', 'Developers'], | ||
raw_attributes: { | ||
@@ -166,2 +167,3 @@ email: 'foo@test.com', | ||
last_name: 'bar', | ||
groups: ['Admins', 'Developers'], | ||
}, | ||
@@ -187,2 +189,53 @@ }, | ||
}); | ||
describe('without a groups attribute', () => { | ||
it('sends a request to the WorkOS api for a profile', () => __awaiter(void 0, void 0, void 0, function* () { | ||
const mock = new axios_mock_adapter_1.default(axios_1.default); | ||
const expectedBody = new URLSearchParams({ | ||
client_id: 'proj_123', | ||
client_secret: 'sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU', | ||
code: 'authorization_code', | ||
grant_type: 'authorization_code', | ||
}); | ||
expectedBody.sort(); | ||
mock.onPost('/sso/token').replyOnce((config) => { | ||
const actualBody = new URLSearchParams(config.data); | ||
actualBody.sort(); | ||
if (actualBody.toString() === expectedBody.toString()) { | ||
return [ | ||
200, | ||
{ | ||
access_token: '01DMEK0J53CVMC32CK5SE0KZ8Q', | ||
profile: { | ||
id: 'prof_123', | ||
idp_id: '123', | ||
organization_id: 'org_123', | ||
connection_id: 'conn_123', | ||
connection_type: 'OktaSAML', | ||
email: 'foo@test.com', | ||
first_name: 'foo', | ||
last_name: 'bar', | ||
raw_attributes: { | ||
email: 'foo@test.com', | ||
first_name: 'foo', | ||
last_name: 'bar', | ||
}, | ||
}, | ||
}, | ||
]; | ||
} | ||
return [404]; | ||
}); | ||
const workos = new workos_1.WorkOS('sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU'); | ||
const { access_token: accessToken, profile } = yield workos.sso.getProfileAndToken({ | ||
code: 'authorization_code', | ||
clientID: 'proj_123', | ||
}); | ||
expect(mock.history.post.length).toBe(1); | ||
const { data, headers } = mock.history.post[0]; | ||
expect(data).toMatchSnapshot(); | ||
expect(headers).toMatchSnapshot(); | ||
expect(accessToken).toBe('01DMEK0J53CVMC32CK5SE0KZ8Q'); | ||
expect(profile).toMatchSnapshot(); | ||
})); | ||
}); | ||
}); | ||
@@ -205,2 +258,3 @@ describe('getProfile', () => { | ||
last_name: 'bar', | ||
groups: ['Admins', 'Developers'], | ||
raw_attributes: { | ||
@@ -210,2 +264,3 @@ email: 'foo@test.com', | ||
last_name: 'bar', | ||
groups: ['Admins', 'Developers'], | ||
}, | ||
@@ -212,0 +267,0 @@ }); |
@@ -28,3 +28,3 @@ "use strict"; | ||
const bad_request_exception_1 = require("./common/exceptions/bad-request.exception"); | ||
const VERSION = '2.16.0'; | ||
const VERSION = '2.17.0'; | ||
const DEFAULT_HOSTNAME = 'api.workos.com'; | ||
@@ -31,0 +31,0 @@ class WorkOS { |
{ | ||
"version": "2.16.0", | ||
"version": "2.17.0", | ||
"name": "@workos-inc/node", | ||
@@ -12,3 +12,3 @@ "author": "WorkOS", | ||
"volta": { | ||
"node": "14.21.1", | ||
"node": "14.21.2", | ||
"yarn": "1.22.19" | ||
@@ -44,12 +44,12 @@ }, | ||
"@types/jest": "27.5.2", | ||
"@types/node": "14.18.34", | ||
"@types/node": "14.18.36", | ||
"@types/pluralize": "0.0.29", | ||
"axios-mock-adapter": "1.21.2", | ||
"jest": "27.5.1", | ||
"prettier": "2.8.1", | ||
"prettier": "2.8.3", | ||
"supertest": "6.2.3", | ||
"ts-jest": "27.1.5", | ||
"tslint": "6.1.3", | ||
"typescript": "4.9.4" | ||
"typescript": "4.9.5" | ||
} | ||
} |
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
188996
4175