Complete traditional login and registration
Complete traditional login via the oauth/auth_native_traditional call with required fields from the sign-in form.
$api_call= '/oauth/auth_native_traditional';
$params= array(
'client_id'=> JANRAIN_LOGIN_CLIENT_ID,
'flow'=> JANRAIN_FLOW_NAME,
'flow_version'=> JANRAIN_FLOW_VERSION,
'locale'=> 'en-US',
'redirect_uri'=> 'https://localhost',
'response_type'=> 'code',
// the name of your sign-in form as defined in the flow file
'form'=> 'signInForm',
// required fields from signInForm
'signInEmailAddress'=> $_POST['email'],
'currentPassword'=> $_POST['password']
);
$curl= curl_init();
curl_setopt($curl,CURLOPT_URL,JANRAIN_CAPTURE_URL.$api_call);
cur_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($params));
$api_response= json_decode(curl_exec($curl));
curl_close($curl);
Response | Outcome / Next Step |
---|---|
Success (ok) | New authorization code is returned. Next step: Exchange an authorization code for an access token and refresh token. |
User not found / Incorrect username or password (invalid_credentials) | Provide paths for Traditional Registration and Reset a password. |
Field validation error (invalid_form_fields) | Display validation message(s). |
Traditional registration
Complete traditional registration via the /oauth/register_native_traditional call with required fields from the registration form.
$api_call= '/oauth/register_native_traditional';
$params= array(
'client_id'=> JANRAIN_LOGIN_CLIENT_ID,
'flow'=> JANRAIN_FLOW_NAME,
'flow_version'=> JANRAIN_FLOW_VERSIONS,
'locale'=> 'en-US',
'redirect_uri'=> 'https://localhost',
'response_type'=> 'code',
// the name of your registration form as defined in the flow file
'form'=> 'registrationForm',
// required fields from registrationForm
'firstName'=> $_POST['firstName'],
'lastName'=> $_POST['lastName'],
'displayName'=> $_POST['displayName'],
'emailAddress'=> $_POST['email'],
'newPassword'=> $_POST['password'],
'newPasswordConfirm'=> $_POST['passwordConfirm']
);
$curl= curl_init();
curl_setopt($curl,CURLOPT_URL,JANRAIN_CAPTURE_URL.$api_call);
curl_setopt($curl,CURLOPT_POST,true);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($params));
$api_response= json_decode(cur_exec($curl));
curl_close($curl);
Response | Outcome / Next Step |
---|---|
Success (ok) | User record is created and new authorization code is returned. Next step: Exchange an authorization code for an access token and refresh token. |
Email address is already in use (invalid_form_fields) | Display validation message, prompt user to authenticate again using the login method they previously used, or attempt to use the Reset a password ](doc:reset-a-user-password) feature. |
Other field validation error (invalid_form_fields) | Display validation message(s). |
Updated about 1 year ago