workos 4.4.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0788087be575732297410a9b832a1290f5615b632560366589db388e1b6ec8d
4
- data.tar.gz: 97493a7743daa8994b65319882e3c3351361ea2a8a289c425abd6fc04023098f
3
+ metadata.gz: 49c966155f5c153170aeeb3ef517c42e6967a297e875ebea314ffc155fdea5f3
4
+ data.tar.gz: 96a7dc5083766f28f6b23f533ffc064e4d1708d19063787ecf8f94f1d5ff09ae
5
5
  SHA512:
6
- metadata.gz: fa8eca58f02a95f137a610033413f408477bdc8bcf66c14ddb9bda85be3e6f2bf008031b5cf7e13fd501962f4ab4c183b73477216879cfe86d9c9c3cf086c123
7
- data.tar.gz: f156a6d7a1d032753dc7f79b478acd492f81b164bf974432ae1f3a7c2770145e347c4b501e1aaf42b8716eb67c7401fd167558859645f7090e79f638519ae1b6
6
+ metadata.gz: 3e0029ae78436134df06312c02a02490e75f9bc62c23a83e70e647bc0ef5384d7fc7ced8351760291743b2aba3f799171eb242c3c3cad8f8d2940bc95881c288
7
+ data.tar.gz: 0ad84d7083020a2d3b8a356064fd4ecc5edc4c9a6aad91ff9b73c28ffcbfa74e6e4a1f0d8131005b87ec658fed0dcb4267ef95539432d4195829e744a9269464
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- workos (4.4.0)
4
+ workos (4.5.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -7,7 +7,7 @@ module WorkOS
7
7
  class Invitation
8
8
  include HashProvider
9
9
 
10
- attr_accessor :id, :email, :state, :accepted_at, :revoked_at,
10
+ attr_accessor :id, :email, :state, :accepted_at, :revoked_at, :accept_invitation_url,
11
11
  :expires_at, :token, :organization_id, :created_at, :updated_at
12
12
 
13
13
  def initialize(json)
@@ -17,6 +17,7 @@ module WorkOS
17
17
  @email = hash[:email]
18
18
  @state = hash[:state]
19
19
  @token = hash[:token]
20
+ @accept_invitation_url = hash[:accept_invitation_url]
20
21
  @organization_id = hash[:organization_id]
21
22
  @accepted_at = hash[:accepted_at]
22
23
  @revoked_at = hash[:revoked_at]
@@ -31,6 +32,7 @@ module WorkOS
31
32
  email: email,
32
33
  state: state,
33
34
  token: token,
35
+ accept_invitation_url: accept_invitation_url,
34
36
  organization_id: organization_id,
35
37
  accepted_at: accepted_at,
36
38
  revoked_at: revoked_at,
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WorkOS
4
+ # The MagicAuth class provides a lightweight wrapper around a WorkOS MagicAuth
5
+ # resource. This class is not meant to be instantiated in a user space,
6
+ # and is instantiated internally but exposed.
7
+ class MagicAuth
8
+ include HashProvider
9
+
10
+ attr_accessor :id, :user_id, :email,
11
+ :expires_at, :code, :created_at, :updated_at
12
+
13
+ def initialize(json)
14
+ hash = JSON.parse(json, symbolize_names: true)
15
+
16
+ @id = hash[:id]
17
+ @user_id = hash[:user_id]
18
+ @email = hash[:email]
19
+ @code = hash[:code]
20
+ @expires_at = hash[:expires_at]
21
+ @created_at = hash[:created_at]
22
+ @updated_at = hash[:updated_at]
23
+ end
24
+
25
+ def to_json(*)
26
+ {
27
+ id: id,
28
+ user_id: user_id,
29
+ email: email,
30
+ code: code,
31
+ expires_at: expires_at,
32
+ created_at: created_at,
33
+ updated_at: updated_at,
34
+ }
35
+ end
36
+ end
37
+ end
@@ -31,7 +31,7 @@ module WorkOS
31
31
  end
32
32
 
33
33
  class << self
34
- include Client
34
+ include Client, Deprecation
35
35
 
36
36
  PROVIDERS = WorkOS::UserManagement::Types::Provider::ALL
37
37
  AUTH_FACTOR_TYPES = WorkOS::UserManagement::Types::AuthFactorType::ALL
@@ -537,12 +537,52 @@ module WorkOS
537
537
  ).to_s
538
538
  end
539
539
 
540
+ # Gets a Magic Auth object
541
+ #
542
+ # @param [String] id The unique ID of the MagicAuth object.
543
+ #
544
+ # @return WorkOS::MagicAuth
545
+ def get_magic_auth(id:)
546
+ response = execute_request(
547
+ request: get_request(
548
+ path: "/user_management/magic_auth/#{id}",
549
+ auth: true,
550
+ ),
551
+ )
552
+
553
+ WorkOS::MagicAuth.new(response.body)
554
+ end
555
+
556
+ # Creates a MagicAuth code
557
+ #
558
+ # @param [String] email The email address of the recipient.
559
+ # @param [String] invitation_token The token of an Invitation, if required.
560
+ #
561
+ # @return WorkOS::MagicAuth
562
+ def create_magic_auth(email:, invitation_token: nil)
563
+ response = execute_request(
564
+ request: post_request(
565
+ path: '/user_management/magic_auth',
566
+ body: {
567
+ email: email,
568
+ invitation_token: invitation_token,
569
+ },
570
+ auth: true,
571
+ ),
572
+ )
573
+
574
+ WorkOS::MagicAuth.new(response.body)
575
+ end
576
+
540
577
  # Create a one-time Magic Auth code and emails it to the user.
541
578
  #
542
579
  # @param [String] email The email address the one-time code will be sent to.
543
580
  #
544
581
  # @return Boolean
545
582
  def send_magic_auth_code(email:)
583
+ warn_deprecation '`send_magic_auth_code` is deprecated.
584
+ Please use `create_magic_auth` instead. This method will be removed in a future major version.'
585
+
546
586
  response = execute_request(
547
587
  request: post_request(
548
588
  path: '/user_management/magic_auth/send',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WorkOS
4
- VERSION = '4.4.0'
4
+ VERSION = '4.5.0'
5
5
  end
data/lib/workos.rb CHANGED
@@ -59,6 +59,7 @@ module WorkOS
59
59
  autoload :Factor, 'workos/factor'
60
60
  autoload :Impersonator, 'workos/impersonator'
61
61
  autoload :Invitation, 'workos/invitation'
62
+ autoload :MagicAuth, 'workos/magic_auth'
62
63
  autoload :MFA, 'workos/mfa'
63
64
  autoload :Organization, 'workos/organization'
64
65
  autoload :Organizations, 'workos/organizations'
@@ -618,6 +618,46 @@ describe WorkOS::UserManagement do
618
618
  end
619
619
  end
620
620
 
621
+ describe '.get_magic_auth' do
622
+ context 'with a valid id' do
623
+ it 'returns a magic_auth object' do
624
+ VCR.use_cassette 'user_management/get_magic_auth/valid' do
625
+ magic_auth = described_class.get_magic_auth(
626
+ id: 'magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9',
627
+ )
628
+
629
+ expect(magic_auth.id.instance_of?(String))
630
+ expect(magic_auth.instance_of?(WorkOS::MagicAuth))
631
+ end
632
+ end
633
+ end
634
+
635
+ context 'with an invalid id' do
636
+ it 'raises an error' do
637
+ VCR.use_cassette('user_management/get_magic_auth/invalid') do
638
+ expect do
639
+ WorkOS::UserManagement.get_magic_auth(id: 'invalid')
640
+ end.to raise_error(WorkOS::APIError, /MagicAuth not found/)
641
+ end
642
+ end
643
+ end
644
+ end
645
+
646
+ describe '.create_magic_auth' do
647
+ context 'with valid payload' do
648
+ it 'creates a magic_auth' do
649
+ VCR.use_cassette 'user_management/create_magic_auth/valid' do
650
+ magic_auth = described_class.create_magic_auth(
651
+ email: 'test@workos.com',
652
+ )
653
+
654
+ expect(magic_auth.id).to eq('magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9')
655
+ expect(magic_auth.email).to eq('test@workos.com')
656
+ end
657
+ end
658
+ end
659
+ end
660
+
621
661
  describe '.send_magic_auth_code' do
622
662
  context 'with valid parameters' do
623
663
  it 'sends a magic link to the email address' do
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.workos.com/user_management/magic_auth
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"email":"test@workos.com","invitation_token":null}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 201
23
+ message: Created
24
+ headers:
25
+ Date:
26
+ - Thu, 02 May 2024 23:50:29 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Content-Length:
30
+ - '274'
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 87dbe9f0989051df-DEN
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"112-XzVK2s+8XVoqs9cCTPJC7VyC3IQ"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Access-Control-Allow-Credentials:
44
+ - 'true'
45
+ Content-Security-Policy:
46
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
47
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
48
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
49
+ Expect-Ct:
50
+ - max-age=0
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Dns-Prefetch-Control:
56
+ - 'off'
57
+ X-Download-Options:
58
+ - noopen
59
+ X-Frame-Options:
60
+ - SAMEORIGIN
61
+ X-Permitted-Cross-Domain-Policies:
62
+ - none
63
+ X-Request-Id:
64
+ - 0ffddb81-5eac-4de6-b5a9-e93fade6db93
65
+ X-Xss-Protection:
66
+ - '0'
67
+ Set-Cookie:
68
+ - __cf_bm=Vlzipf6hw8yFfYVC2LuTclSbuxE96I2boK9h6dPBL8Q-1714693829-1.0.1.1-r0i0ukq1UXcWzb3__XYkiwuWdnr5jKhXUTYKG_qhrrhgDNzb7o7cUugM4YPS1YWV5RS1xdvDBXigLY0AV66mAg;
69
+ path=/; expires=Fri, 03-May-24 00:20:29 GMT; domain=.workos.com; HttpOnly;
70
+ Secure; SameSite=None
71
+ - __cfruid=94afbb49471958910ded5cab91db63de8d3d47e6-1714693829; path=/; domain=.workos.com;
72
+ HttpOnly; Secure; SameSite=None
73
+ Server:
74
+ - cloudflare
75
+ body:
76
+ encoding: UTF-8
77
+ string: '{"object":"magic_auth","id":"magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9","user_id":"user_01HWXVEWSWSJ66VE29AD14KZ0C","email":"test@workos.com","code":"500013","expires_at":"2024-05-03T00:00:29.528Z","created_at":"2024-05-02T23:50:29.479Z","updated_at":"2024-05-02T23:50:29.479Z"}'
78
+ http_version:
79
+ recorded_at: Thu, 02 May 2024 23:50:29 GMT
80
+ recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: ASCII-8BIT
79
- string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
79
+ string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
80
80
  http_version:
81
81
  recorded_at: Mon, 14 Aug 2023 21:42:04 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/user_management/magic_auth/invalid
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 404
23
+ message: Not Found
24
+ headers:
25
+ Date:
26
+ - Thu, 02 May 2024 23:53:49 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 87dbeed57a5a7c25-DEN
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"8a-boo9lPL4s/fqPxV0Hun3Ue0NFew"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Access-Control-Allow-Credentials:
44
+ - 'true'
45
+ Content-Security-Policy:
46
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
47
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
48
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
49
+ Expect-Ct:
50
+ - max-age=0
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Dns-Prefetch-Control:
56
+ - 'off'
57
+ X-Download-Options:
58
+ - noopen
59
+ X-Frame-Options:
60
+ - SAMEORIGIN
61
+ X-Permitted-Cross-Domain-Policies:
62
+ - none
63
+ X-Request-Id:
64
+ - 12cb618c-5540-43f8-8178-49a7be2248f9
65
+ X-Xss-Protection:
66
+ - '0'
67
+ Set-Cookie:
68
+ - __cf_bm=X3.gnPiStpnIVzd_Qb5C1PUDQzD32Tj0PQ8CEME.KTQ-1714694029-1.0.1.1-WDZ9aX_PJfAtBDTUj9ukw8GtaRhOVXH0vH6tThVOZNhRk34Dpc_gqE1yEDegGQYHmlt.iXgul.WNXBE0ARpf_g;
69
+ path=/; expires=Fri, 03-May-24 00:23:49 GMT; domain=.workos.com; HttpOnly;
70
+ Secure; SameSite=None
71
+ - __cfruid=39f5b22af74b005f407c542836af9e55e6d29816-1714694029; path=/; domain=.workos.com;
72
+ HttpOnly; Secure; SameSite=None
73
+ Server:
74
+ - cloudflare
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: '{"message":"MagicAuth not found: ''magic_auth_invalid''.","code":"entity_not_found","entity_id":"magic_auth_invalid"}'
78
+ http_version:
79
+ recorded_at: Thu, 02 May 2024 23:53:49 GMT
80
+ recorded_with: VCR 5.0.0
@@ -0,0 +1,80 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.workos.com/user_management/magic_auth/magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ User-Agent:
17
+ - WorkOS; ruby/3.0.2; x86_64-darwin19; v4.4.0
18
+ Authorization:
19
+ - Bearer <API_KEY>
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Date:
26
+ - Thu, 02 May 2024 23:53:49 GMT
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ Transfer-Encoding:
30
+ - chunked
31
+ Connection:
32
+ - keep-alive
33
+ Cf-Ray:
34
+ - 87dbeed47df151f4-DEN
35
+ Cf-Cache-Status:
36
+ - DYNAMIC
37
+ Etag:
38
+ - W/"112-XzVK2s+8XVoqs9cCTPJC7VyC3IQ"
39
+ Strict-Transport-Security:
40
+ - max-age=15552000; includeSubDomains
41
+ Vary:
42
+ - Origin, Accept-Encoding
43
+ Access-Control-Allow-Credentials:
44
+ - 'true'
45
+ Content-Security-Policy:
46
+ - 'default-src ''self'';base-uri ''self'';block-all-mixed-content;font-src ''self''
47
+ https: data:;frame-ancestors ''self'';img-src ''self'' data:;object-src ''none'';script-src
48
+ ''self'';script-src-attr ''none'';style-src ''self'' https: ''unsafe-inline'';upgrade-insecure-requests'
49
+ Expect-Ct:
50
+ - max-age=0
51
+ Referrer-Policy:
52
+ - no-referrer
53
+ X-Content-Type-Options:
54
+ - nosniff
55
+ X-Dns-Prefetch-Control:
56
+ - 'off'
57
+ X-Download-Options:
58
+ - noopen
59
+ X-Frame-Options:
60
+ - SAMEORIGIN
61
+ X-Permitted-Cross-Domain-Policies:
62
+ - none
63
+ X-Request-Id:
64
+ - 6f38d8ca-904f-4940-9730-4d99e2d20496
65
+ X-Xss-Protection:
66
+ - '0'
67
+ Set-Cookie:
68
+ - __cf_bm=bIa76a4FQCxR5oYEFQNr.0UhmZVnvLLanztY9NFBwU4-1714694029-1.0.1.1-DzZkmhziT4tSpAsSZeVbyo63E5nFiiF8FTiZzuaERD.QiWNXfAP5zI9KlghVfgv0FzogjoFzubEGmY_S1Xu.zg;
69
+ path=/; expires=Fri, 03-May-24 00:23:49 GMT; domain=.workos.com; HttpOnly;
70
+ Secure; SameSite=None
71
+ - __cfruid=39f5b22af74b005f407c542836af9e55e6d29816-1714694029; path=/; domain=.workos.com;
72
+ HttpOnly; Secure; SameSite=None
73
+ Server:
74
+ - cloudflare
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: '{"object":"magic_auth","id":"magic_auth_01HWXVEWWSMR5HS8M6FBGMBJJ9","user_id":"user_01HWXVEWSWSJ66VE29AD14KZ0C","email":"test@workos.com","code":"500013","expires_at":"2024-05-03T00:00:29.528Z","created_at":"2024-05-02T23:50:29.479Z","updated_at":"2024-05-02T23:50:29.479Z"}'
78
+ http_version:
79
+ recorded_at: Thu, 02 May 2024 23:53:49 GMT
80
+ recorded_with: VCR 5.0.0
@@ -77,7 +77,7 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
80
+ string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
81
81
  http_version:
82
82
  recorded_at: Mon, 09 Aug 2021 22:01:16 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -77,7 +77,7 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test3@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
80
+ string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test3@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
81
81
  http_version:
82
82
  recorded_at: Mon, 09 Aug 2021 22:01:16 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -77,7 +77,7 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
80
+ string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test2@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
81
81
  http_version:
82
82
  recorded_at: Mon, 09 Aug 2021 22:01:15 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -77,7 +77,7 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_02H5JQDV7R7ATEYZDEG0W5PRYS","email":"john@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_02H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_03H5JQDV7R7ATEYZDEG0W5PRYS","email":"jane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_03H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_04H5JQDV7R7ATEYZDEG0W5PRYS","email":"emma@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_04H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_05H5JQDV7R7ATEYZDEG0W5PRYS","email":"alex@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_05H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before_id","after":null}}'
80
+ string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_02H5JQDV7R7ATEYZDEG0W5PRYS","email":"john@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_02H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_03H5JQDV7R7ATEYZDEG0W5PRYS","email":"jane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_03H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_04H5JQDV7R7ATEYZDEG0W5PRYS","email":"emma@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_04H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"},{"object":"invitation","id":"invitation_05H5JQDV7R7ATEYZDEG0W5PRYS","email":"alex@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_05H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":"before_id","after":null}}'
81
81
  http_version:
82
82
  recorded_at: Mon, 09 Aug 2021 22:01:14 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -77,7 +77,7 @@ http_interactions:
77
77
  ma=86400
78
78
  body:
79
79
  encoding: ASCII-8BIT
80
- string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
80
+ string: '{"object":"list","data":[{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"dane@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}],"list_metadata":{"before":null,"after":null}}'
81
81
  http_version:
82
82
  recorded_at: Mon, 09 Aug 2021 22:01:15 GMT
83
83
  recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: UTF-8
79
- string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
79
+ string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
80
80
  http_version:
81
81
  recorded_at: Thu, 31 Aug 2023 16:41:46 GMT
82
82
  recorded_with: VCR 5.0.0
@@ -76,7 +76,7 @@ http_interactions:
76
76
  - cloudflare
77
77
  body:
78
78
  encoding: UTF-8
79
- string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
79
+ string: '{"object":"invitation","id":"invitation_01H5JQDV7R7ATEYZDEG0W5PRYS","email":"test@workos.com","state":"pending","accepted_at":"2023-07-18T02:07:19.911Z","revoked_at":"2023-07-18T02:07:19.911Z","expires_at":"2023-07-18T02:07:19.911Z","organization_id":"org_01H5JQDV7R7ATEYZDEG0W5PRYS","token":"Z1uX3RbwcIl5fIGJJJCXXisdI","accept_invitation_url":"https://myauthkit.com/invite?invitation_token=Z1uX3RbwcIl5fIGJJJCXXisdI","created_at":"2023-07-18T02:07:19.911Z","updated_at":"2023-07-18T02:07:19.911Z"}'
80
80
  http_version:
81
81
  recorded_at: Tue, 22 Aug 2023 15:17:54 GMT
82
82
  recorded_with: VCR 5.0.0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workos
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - WorkOS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-01 00:00:00.000000000 Z
11
+ date: 2024-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,7 @@ files:
125
125
  - lib/workos/hash_provider.rb
126
126
  - lib/workos/impersonator.rb
127
127
  - lib/workos/invitation.rb
128
+ - lib/workos/magic_auth.rb
128
129
  - lib/workos/mfa.rb
129
130
  - lib/workos/organization.rb
130
131
  - lib/workos/organization_membership.rb
@@ -268,6 +269,7 @@ files:
268
269
  - spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml
269
270
  - spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml
270
271
  - spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml
272
+ - spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml
271
273
  - spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml
272
274
  - spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml
273
275
  - spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml
@@ -280,6 +282,8 @@ files:
280
282
  - spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml
281
283
  - spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml
282
284
  - spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml
285
+ - spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml
286
+ - spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml
283
287
  - spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml
284
288
  - spec/support/fixtures/vcr_cassettes/user_management/get_user.yml
285
289
  - spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml
@@ -462,6 +466,7 @@ test_files:
462
466
  - spec/support/fixtures/vcr_cassettes/user_management/authenticate_with_totp/valid.yml
463
467
  - spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/invalid.yml
464
468
  - spec/support/fixtures/vcr_cassettes/user_management/confirm_password_reset/valid.yml
469
+ - spec/support/fixtures/vcr_cassettes/user_management/create_magic_auth/valid.yml
465
470
  - spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/invalid.yml
466
471
  - spec/support/fixtures/vcr_cassettes/user_management/create_organization_membership/valid.yml
467
472
  - spec/support/fixtures/vcr_cassettes/user_management/create_user_invalid.yml
@@ -474,6 +479,8 @@ test_files:
474
479
  - spec/support/fixtures/vcr_cassettes/user_management/enroll_auth_factor/valid.yml
475
480
  - spec/support/fixtures/vcr_cassettes/user_management/get_invitation/invalid.yml
476
481
  - spec/support/fixtures/vcr_cassettes/user_management/get_invitation/valid.yml
482
+ - spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/invalid.yml
483
+ - spec/support/fixtures/vcr_cassettes/user_management/get_magic_auth/valid.yml
477
484
  - spec/support/fixtures/vcr_cassettes/user_management/get_organization_membership.yml
478
485
  - spec/support/fixtures/vcr_cassettes/user_management/get_user.yml
479
486
  - spec/support/fixtures/vcr_cassettes/user_management/list_auth_factors/invalid.yml