/oauth/register_native

This endpoint is used to complete social registration. To make this call, you first make a call to aoauth/auth_native for two reasons:

  1. oauth/register_native will not accept the token if you have not called oauth/auth_native first.
  2. If you included the registration_form parameter in the call to oauth/auth_native, the data from the social provider's payload can be used to pre-populate fields in your social registration form.

Then, you can take the same Social Login token you used in the oauth/auth_native call and use it in the oauth/register_native call.

Note. This must be a POST request with all parameters included in the body of the request; they cannot be passed as URL parameters.

This endpoint supports the following methods:

  • POST

POST

Base URL

The base URL for this endpoint is your Janrain Capture domain; for example:

https://educationcenter.us-dev.janraincapture.com

Your Capture domains (also known as Registration domains) can be found in the Janrain Console on the Manage Application page:

Examples

Example: Complete Social Registration

Note that if you attempt to call oauth/register_native without first calling oauth/auth_native, then you will receive an error stating the Social Login token is invalid.


curl -X POST \
    --data-urlencode 'client_id=12345abcde12345abcde12345abcde12'\
    --data-urlencode 'flow=standard'\
    --data-urlencode 'flow_version=67890def-6789-defg-6789-67890defgh67'\
    --data-urlencode 'locale=en-US'\
    --data-urlencode 'redirect_uri=http://localhost'\
    --data-urlencode 'token=12ab34cd56ef78gh90ij12kl34mn56op78qr90st'\
    --data-urlencode 'form=socialRegistrationForm'\
    --data-urlencode 'emailAddress=janedoe@example.com'\
    --data-urlencode 'lastName=Doe'\
    --data-urlencode 'firstName=Jane'\
    --data-urlencode 'displayName=JaneDoe'\
    --data-urlencode 'birthdate[dateselect_year]=1930'\
    --data-urlencode 'birthdate[dateselect_month]=11'\
    --data-urlencode 'birthdate[dateselect_day]=3'\
    'https://my-app.janraincapture.com/oauth/register_native'
                                                            

Running Code Samples Using Postman

The Janrain REST API code samples are written using Curl, but they can easily be run from within Postman. To use one of our code samples in Postman:

  1. Click the Copy to Clipboard button located directly beneath the code sample
  2. In Postman, click Import to display the Import dialog box.
  3. In the Import dialog box, click Paste Raw Text, and then paste in the copied code. The Import dialog box should look similar to this:

  4. Click Import, and the Curl command will be converted to a format that can be run from within Postman. All you need to do now is configure the command to work with your Janrain implementation.

Authorized Clients

login_client

Security

  •  none-required

Query Parameters

Parameter Type Required Description
client_id string Yes API client ID that will be used to authenticate the call. This client must be configured with the login_client feature, which gives it permission to use login and registration-based API endpoints. API client permissions can be configured using the sclients/set_features endpoint.
 
flow string Yes Name of the flow configured with the social registration experience you want to use. This parameter corresponds to the janrain.settings.capture.flowNameJavaScript setting used in widget- based implementations. If you have multiple flows, you can find a list of valid flow names using the Configuration API. You can omit this parameter if you configure the flow name in the default_flow_name setting for the API client used to make this call.
 
flow_version string Yes Version number of the flow set in the flow parameter. This parameter corresponds to the janrain.settings.capture.flowVersion JavaScript setting used in widget-based implementations; however, this call will not accept a version of HEAD as the setting does. Instead, you must specify the version number if you want to use the most recent version. You can find a list of versions for your flow using the Configuration API. You can omit this parameter if you configure the flow version in the default_flow_version setting for the API client used to make this call.
 
form string Yes Name of the form to be used to for social registration. This parameter determines the field names that must be included when submitting this API call. The default form name for email verification configured for the standard flow is socialRegistrationForm, but you can find a list of valid forms and associated fields for your flow using the Configuration API. This form name corresponds to the name of the JTL tag used for the associated form in widget-based implementations (for example, {* #socialRegistrationForm *}).
 
(form fields) string Yes Names of the fields configured in your flow as part of the social registration form. Each field must be passed as a separate parameter; use the field name as the key and the user input as the value. All fields configured as required in the flow for the form must be included. The default socialRegistrationFormconfigured for the standard flow includes emailAddress, firstName, lastName, and displayName as required fields. You can find a list of valid fields for your traditional registration form using the Configuration API. These field names correspond to the name of the JTL tags included inside the associated form in widget-based implementations.
 
locale string Yes Code for the language you want to use for the registration experience. This parameter determines the language for any error messages returned to you and any registration confirmation emails sent to users, and corresponds to the janrain.settings.language JavaScript setting used in widget-based implementations. The default locale provisioned with the standard Registration flow is en-US; other locales must be configured in your flow. You can find a list of valid locales for your flow using the Configuration API.
 
redirect_uri string Yes Required for legacy purposes and is not used for any functionality in this call. The parameter value must begin with http: or https: and we recommend that this match the URL and protocol of your website. This parameter corresponds to the janrain.settings.capture.redirectUri JavaScript setting used in widget-based implementations.
 
response_type string Determines whether you will receive an access token, an authorization code, or both after a user is successfully registered or authenticated; if omitted, the response type will default to token. This parameter corresponds to the janrain.settings.capture.responseTypeJavaScript setting used in widget-based implementations. Allowed values are:
  • code
  • token
  • code_and_token
token string Yes One-time token used for social authentication. This is the token passed from the Social Login application to your token url. It must be received from the same Social Login application configured for the API client used to make this call; this can be configured in the Default Settings for your Registration application if you have a single Social Login application. The token will be a unique 40-character string and can be used with the auth_info endpoint to retrieve a user's social profile directly. However, this is typically not necessary when using the oauth endpoints for registration, because that data is automatically retrieved and stored for you.
 

Responses

200 OK

Successful Response

A successful response will return the user profile in the capture_user object along with an access_token or authorization_code depending on the response_type parameter you included in the call.


{
  "capture_user": {
    "created": "2016-04-20 17:02:18.649505 +0000",
    "uuid": "67890def-6789-defg-6789-67890defgh67",
    // additional profile data...
  },
  "is_new": false,
  "stat": "ok",
  "access_token": "z0y98xv76u5t4rs3"
}
                                                            

Error - Invalid Social Login Token

The example error response below indicates that the Social Login token passed into the call is invalid or expired. Note that you will also see this error if you have not called oauth/auth_native first.


{
  "stat": "error",
  "code": 200,
  "error_description": "the token you passed was not valid",
  "error": "invalid_argument",
  "request_id": "f5q326y8ef2tmfcq"
}
                                                            

Error - Invalid Form

The example error response below indicates that the form value is not valid for the flow included in the call. Form names are case sensitive, so socialregistrationform would fail if socialRegistrationForm is the valid form name.


{
  "stat": "error",
  "code": 200,
  "error_description": "no such form 'socialregistrationform'",
  "error": "invalid_argument",
  "request_id": "rdfbsavfvzb2sxud"
}
                                                            

Error - Field Validation Errors

The example error response below indicates that validation failed for some fields configured with the form used in the call. All validation rules for these fields are checked, so you may receive errors for multiple fields and multiple errors on a single field. Validation errors are commonly encountered when a required field is missing, the email address or another unique field is already taken, or the user input does not pass formatting validation applied to a field. The invalid_fieldsobject will include field names mapped to a list of localized error messages from the flow for each validation that failed.


{
  "stat": "error",
  "code": 390,
  "error_description": "some inputs are invalid",
  "error": "invalid_form_fields",
  "request_id": "eyt2p5thkwch5h2h",
  "invalid_fields": {
    "displayName": [
      "That display name is already taken."
    ],
    "emailAddress": [
      "Email address is required."
    ]
  }
}
                                                            

Error - Missing Required Parameters

The example error response below indicates that one of the required parameters for the call was not included. The error message will describe which parameter is missing.


{
  "stat": "error",
  "code": 100,
  "error_description": "missing arguments: flow",
  "error": "missing_argument",
  "request_id": "uyeem84bmqmnjuu4"
}
                                                            

Error - Invalid Flow Value

The example error response below indicates that the value provided for one or more of the flow, flow_version, or locale parameters is invalid. Flow versions are unique across environments, so check that the version value included in the call is for the correct environment (that is, your development or production application).


{
  "stat": "error",
  "code": 500,
  "error_description": "could not find a flow named 'standard' with version '12345abc-1234-abcd-1234-12345abcde12' and locale 'en-US'",
  "error": "unexpected_error",
  "request_id": "murynd7fhpysq6um"
}
                                                            

Error - Invalid API Client Permissions

The example error response below indicates that the API client used to make the call is not configured with the login_client feature.


{
  "stat": "error",
  "code": 403,
  "error_description": "This client does not support log in and registration.",
  "error": "permission_error",
  "request_id": "y3sthb9dey6mv65e"
}