Open Registration
(Created page with "Working with illegal plumbing professional prevents you from getting a refund if there is a problem with the service. You can refer to the plumbing contractor to give you with...") |
(→Example - Open Registration and Login when email confirmation is turned off) |
||
(12 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | DreamFactory supports open user registration, which allows users to self-register from your application via the API. By default it is disabled. | |
+ | |||
+ | To enable it, log into the admin console, click on the Services tab and select the user service. On the user service details page, click on the Config tab. Check | ||
+ | the 'Allow Open Registration' checkbox there. On this Config page you can also select a role in the 'Open Reg Role' | ||
+ | field. This role will be used for all your self-registered users. | ||
+ | |||
+ | If you would like to require your users to be verified using email confirmation, select an email service in the 'Open Reg Email Service' field. Choose an email template for your | ||
+ | confirmation email in the 'Open Reg Email Template' field. If you do not choose an email service for Open Registration, your users will be forced to choose their password during registration. | ||
+ | |||
+ | [[File:Tutorial open registration1.png|800px]] | ||
+ | |||
+ | === API Endpoint === | ||
+ | |||
+ | <pre>POST https://{url}/api/v2/user/register?login={bool}</pre> | ||
+ | Request body: | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "email": "user_email", //Required field. | ||
+ | "password": "password", //Required only when no Open Registration Email Service is selected. | ||
+ | "first_name": "first_name", | ||
+ | "last_name": "last_name" | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | === Example - Open Registration with email confirmation required === | ||
+ | |||
+ | * Request body: | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "email": "jdoe@example.com", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe" | ||
+ | } | ||
+ | </source> | ||
+ | * Request URL: | ||
+ | <pre>POST https://foo.com/api/v2/user/register</pre> | ||
+ | * Response | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "success":true | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | === Example - Open Registration and Login with email confirmation required === | ||
+ | |||
+ | * Login: true | ||
+ | * Request body: | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "email": "jdoe@example.com", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe" | ||
+ | } | ||
+ | </source> | ||
+ | * Request URL: | ||
+ | <pre>POST https://foo.com/api/v2/user/register?login=true</pre> | ||
+ | * Response | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "success":true, | ||
+ | "confirmation_required": true | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | |||
+ | ''Note: Forcing login during open registration will not work when email confirmation is required. Therefore, response | ||
+ | includes "confirmation_required":true.'' | ||
+ | |||
+ | === Example - Open Registration with email confirmation turned off === | ||
+ | |||
+ | * Request body: | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "email": "jdoe@example.com", | ||
+ | "password":"secret", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe" | ||
+ | } | ||
+ | </source> | ||
+ | * Request URL: | ||
+ | <pre>POST https://foo.com/api/v2/user/register</pre> | ||
+ | * Response | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "success":true | ||
+ | } | ||
+ | </source> | ||
+ | |||
+ | === Example - Open Registration and Login with email confirmation turned off === | ||
+ | |||
+ | * Login: true | ||
+ | * Request body: | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "email": "jdoe@example.com", | ||
+ | "password":"secret", | ||
+ | "first_name": "John", | ||
+ | "last_name": "Doe" | ||
+ | } | ||
+ | </source> | ||
+ | * Request URL: | ||
+ | <pre>POST https://foo.com/api/v2/user/register?login=true</pre> | ||
+ | * Response | ||
+ | <source lang="JavaScript"> | ||
+ | { | ||
+ | "success": true, | ||
+ | "session_token": "abc.123.efg" | ||
+ | } | ||
+ | </source> |
Latest revision as of 16:47, 15 July 2016
DreamFactory supports open user registration, which allows users to self-register from your application via the API. By default it is disabled.
To enable it, log into the admin console, click on the Services tab and select the user service. On the user service details page, click on the Config tab. Check the 'Allow Open Registration' checkbox there. On this Config page you can also select a role in the 'Open Reg Role' field. This role will be used for all your self-registered users.
If you would like to require your users to be verified using email confirmation, select an email service in the 'Open Reg Email Service' field. Choose an email template for your confirmation email in the 'Open Reg Email Template' field. If you do not choose an email service for Open Registration, your users will be forced to choose their password during registration.
Contents
API Endpoint
POST https://{url}/api/v2/user/register?login={bool}
Request body:
{ "email": "user_email", //Required field. "password": "password", //Required only when no Open Registration Email Service is selected. "first_name": "first_name", "last_name": "last_name" }
Example - Open Registration with email confirmation required
- Request body:
{ "email": "jdoe@example.com", "first_name": "John", "last_name": "Doe" }
- Request URL:
POST https://foo.com/api/v2/user/register
- Response
{ "success":true }
Example - Open Registration and Login with email confirmation required
- Login: true
- Request body:
{ "email": "jdoe@example.com", "first_name": "John", "last_name": "Doe" }
- Request URL:
POST https://foo.com/api/v2/user/register?login=true
- Response
{ "success":true, "confirmation_required": true }
Note: Forcing login during open registration will not work when email confirmation is required. Therefore, response includes "confirmation_required":true.
Example - Open Registration with email confirmation turned off
- Request body:
{ "email": "jdoe@example.com", "password":"secret", "first_name": "John", "last_name": "Doe" }
- Request URL:
POST https://foo.com/api/v2/user/register
- Response
{ "success":true }
Example - Open Registration and Login with email confirmation turned off
- Login: true
- Request body:
{ "email": "jdoe@example.com", "password":"secret", "first_name": "John", "last_name": "Doe" }
- Request URL:
POST https://foo.com/api/v2/user/register?login=true
- Response
{ "success": true, "session_token": "abc.123.efg" }