File tree 2 files changed +36
-25
lines changed
2 files changed +36
-25
lines changed Original file line number Diff line number Diff line change
1
+ require 'fusionauth/fusionauth_client'
2
+ require 'securerandom'
3
+
4
+ # Construct the FusionAuth Client
5
+ client = FusionAuth ::FusionAuthClient . new (
6
+ 'APIKEY' ,
7
+ 'http://localhost:9011'
8
+ )
9
+
10
+ application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
11
+
12
+ # Create a user + registration
13
+ id = SecureRandom . uuid
14
+ response = client . register ( id , {
15
+ :user => {
16
+ :firstName => 'Ruby' ,
17
+ :lastName => 'Client' ,
18
+ :email => 'ruby.client.test@fusionauth.io' ,
19
+ :password => 'password'
20
+ } ,
21
+ :registration => {
22
+ :applicationId => application_id ,
23
+ :data => {
24
+ :foo => 'bar'
25
+ } ,
26
+ :preferredLanguages => %w( en fr ) ,
27
+ :roles => %w( user )
28
+ }
29
+ } )
30
+
31
+ unless response . success_response
32
+ print response . error_response
33
+ exit
34
+ end
35
+
Original file line number Diff line number Diff line change 9
9
10
10
application_id = '20ce6dac-b985-4c77-bb59-6369249f884b'
11
11
12
- # Create a user + registration
13
- id = SecureRandom . uuid
14
- response = client . register ( id , {
15
- :user => {
16
- :firstName => 'Ruby' ,
17
- :lastName => 'Client' ,
18
- :email => 'ruby.client.test@fusionauth.io' ,
19
- :password => 'password'
20
- } ,
21
- :registration => {
22
- :applicationId => application_id ,
23
- :data => {
24
- :foo => 'bar'
25
- } ,
26
- :preferredLanguages => %w( en fr ) ,
27
- :roles => %w( user )
28
- }
29
- } )
30
-
31
- unless response . success_response
32
- print response . error_response
33
- exit
34
- end
35
-
36
- # Authenticate the user
12
+ # Authenticate a user
37
13
response = client . login ( {
38
14
:loginId => 'ruby.client.test@fusionauth.io' ,
39
15
:password => 'password' ,
You can’t perform that action at this time.
0 commit comments