You are here

function miniorange_config in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO Login 7

1 call to miniorange_config()
miniorange_oauth_client_config in ./miniorange_oauth_client_config.inc

File

./miniorange_config.php, line 9

Code

function miniorange_config($form, &$formstate) {
  global $base_url;
  drupal_add_css(drupal_get_path('module', 'miniorange_oauth_client') . '/css/bootstrap.min.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  drupal_add_css(drupal_get_path('module', 'miniorange_oauth_client') . '/css/style_settings.css', array(
    'group' => CSS_DEFAULT,
    'every_page' => FALSE,
  ));
  $module_path = drupal_get_path('module', 'miniorange_oauth_client');
  $baseUrlValue = variable_get('miniorange_oauth_client_base_url');
  $baseUrlValue = empty($baseUrlValue) ? $base_url : $baseUrlValue;
  if (!empty(variable_get('miniorange_auth_client_app_name'))) {
    $miniorange_auth_client_callback_uri = variable_get('miniorange_auth_client_callback_uri');
  }
  else {
    $miniorange_auth_client_callback_uri = $baseUrlValue . "/?q=mo_login";
    variable_set('miniorange_auth_client_callback_uri', $miniorange_auth_client_callback_uri);
  }
  $login_path = '<a href=' . $baseUrlValue . '/?q=moLogin>Enter what you want to display on the link</a>';
  $app_name_selected = variable_get('miniorange_oauth_client_app', NULL);
  $client_id = variable_get('miniorange_auth_client_client_id', NULL);
  if (!empty($app_name_selected) && !empty($client_id)) {
    $disabled = TRUE;
    $attributes_arr = array(
      'style' => 'width:73%;background-color: hsla(0,0%,0%,0.08) !important;',
    );
  }
  else {
    $disabled = FALSE;
    $attributes_arr = array(
      'style' => 'width:73%;',
    );
  }
  $disabledButton = NULL;
  if (empty($client_id) || empty($app_name_selected)) {
    $disabledButton = 'disabled';
  }
  $form['header_top_style_1'] = array(
    '#markup' => '<div class="mo_oauth_table_layout_1">',
  );
  $form['markup_top'] = array(
    '#markup' => '<div class="mo_oauth_table_layout mo_oauth_container">',
  );
  $form['markup_top_vt_start'] = array(
    '#markup' => '<div id="tabhead"><b><span style="font-size: 17px;">CONFIGURE OAUTH APPLICATION</span></b>&nbsp;&nbsp;
        <a class="btn btn-success btn-large" style="padding:5px 10px;margin-left: 0px;box-shadow: 0 1px 0 #006799;" ' . $disabledButton . ' onclick="show_backup_form()">Backup/Import</a>
        <a class="btn btn-primary btn-large restart_button" id="restart_tour_button"> Restart Tour</a><br><br><hr><br/></div>',
  );
  $prefixname = '<div class="mo_oauth_row"><div class="mo_oauth_name">';
  $suffixname = '</div>';
  $prefixvalue = '<div class="mo_oauth_value">';
  $suffixvalue = '</div></div>';
  $form['markup_top_head'] = array(
    '#markup' => '<div border="1" id="backup_import_form" class="mo_oauth_backup_download">
        <h3>Backup/ Import Configurations</h3><hr><span class="mo_oauth_backup_cancel">
        <input type="button" class="btn btn-sm btn-danger" value="Cancel" onclick = "hide_backup_form()"/></a><br></span>',
  );
  $form['markup_1s'] = array(
    '#markup' => '<br><br><div class="mo_oauth_highlight_background_note_2" style="width: auto" ><p><b>NOTE: </b>This tab will help you to transfer your module configurations when you change your Drupal instance.
                            <br>Example: When you switch from test environment to production.<br>Follow these 3 simple steps to do that:<br>
                            <br><strong>1.</strong> Download module configuration file by clicking on the Download Configuration button given below.
                            <br><strong>2.</strong> Install the module on new Drupal instance.<br><strong>3.</strong> Upload the configuration file in Import module Configurations section.<br>
                            <br><b>And just like that, all your module configurations will be transferred!</b></p></div>',
  );
  $form['mo_markup_top'] = array(
    '#markup' => '<div><br><br><div class="mo_oauth_container_3" style="text-align: center;float: left;margin-right: 20px;border: solid 1px #00000024;padding-bottom: 55px;">
                        <div><b><span style="font-size: 17px;">EXPORT CONFIGURATION</span></b><br><br><hr><br/><br>',
  );
  $form['miniorange_oauth_export'] = array(
    '#type' => 'submit',
    '#value' => t('Download Module Configuration'),
    '#prefix' => '<td>',
    '#suffix' => '</td>',
    '#submit' => array(
      'miniorange_import_export',
    ),
  );
  $form['miniorange_oauth_import'] = array(
    '#markup' => '</div></div><div class="mo_oauth_container_3" style="float: left;text-align:center;padding-bottom: 20px;border: solid 1px #00000024;;">
                          <b><span style="font-size: 17px;">IMPORT CONFIGURATION <b><a href="' . $base_url . '/admin/config/people/miniorange_oauth_client/licensing"> [Standard]</a></b></span></b><br><br><hr><br>  ',
  );
  $form['import_Config_file'] = array(
    '#type' => 'file',
    '#disabled' => TRUE,
    '#attributes' => array(
      'style' => 'width: 175px;',
    ),
  );
  $form['miniorange_oauth_import_file'] = array(
    '#type' => 'button',
    '#value' => t('Upload'),
    '#disabled' => TRUE,
    '#suffix' => '<br></div></div></div><div id="clientdata">',
  );
  $form['mo_configure_select_vt'] = array(
    '#markup' => '<div id="mo_configure_selectapp_vt">',
  );
  $form['miniorange_oauth_client_app_options'] = array(
    '#type' => 'value',
    '#id' => 'cminiorange_oauth_client_app_options',
    '#value' => array(
      'Select' => t('Select'),
      'Azure AD' => t('Azure AD'),
      'Box' => t('Box'),
      'Discord' => t('Discord'),
      'Facebook' => t('Facebook'),
      'FitBit' => t('FitBit'),
      'Github' => t('Github'),
      'Google' => t('Google'),
      'Keycloak' => t('Keycloak'),
      'Line' => t('Line'),
      'LinkedIn' => t('LinkedIn'),
      'Okta_oauth' => t('Okta (OAuth)'),
      'Salesforce' => t('Salesforce'),
      'Slack' => t('Slack'),
      'Strava' => t('Strava'),
      'Wild Apricot' => t('Wild Apricot'),
      'Zendesk' => t('Zendesk'),
      'Custom' => t('Custom OAuth 2.0 Provider'),
      'Azure AD B2C' => t('Azure AD B2C (Premium and Enterprise)'),
      'AWS Cognito' => t('AWS Cognito (Premium and Enterprise)'),
      'Onelogin' => t('Onelogin (Premium and Enterprise)'),
      'miniOrange' => t('miniOrange (Premium and Enterprise)'),
      'Okta_openid' => t('Okta (OpenID) (Premium and Enterprise)'),
      'Custom_openid' => t('Custom OpenID Provider (We support OpenID protocol in Premium and Enterprise version)'),
    ),
  );
  $form['miniorange_oauth_client_app_title'] = array(
    '#markup' => '<b>Select Application:</b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext">Select an OAuth Server</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_app'] = array(
    '#id' => 'miniorange_oauth_client_app',
    '#type' => 'select',
    '#options' => $form['miniorange_oauth_client_app_options']['#value'],
    '#default_value' => variable_get('miniorange_oauth_client_app', NULL),
    '#disabled' => $disabled,
    '#attributes' => $attributes_arr,
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['mo_configure_vt'] = array(
    '#markup' => '</div><div id="mo_oauth_callback_vt">',
  );
  $form['miniorange_oauth_callback_title'] = array(
    '#markup' => '<b>Callback/Redirect URL:</b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext"><b>Note:</b> If you want to change the <b>Redirect URL</b>, you can provide the site root URL/ base URL in <b>Sign In Settings</b> tab.</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_callback'] = array(
    '#type' => 'textfield',
    '#id' => 'callbackurl',
    '#default_value' => $miniorange_auth_client_callback_uri,
    '#disabled' => true,
    '#attributes' => array(
      'style' => 'width:73%;background-color: hsla(0,0%,0%,0.08) !important;',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['mo_configure_vt_1'] = array(
    '#markup' => '</div><div id="mo_select_app_config_vt">',
  );
  $form['miniorange_oauth_app_name_title'] = array(
    '#markup' => '<b>Display Name:</b>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_app_name'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('miniorange_auth_client_app_name', NULL),
    '#id' => 'miniorange_oauth_client_app_name',
    '#disabled' => $disabled,
    '#attributes' => $attributes_arr,
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['miniorange_oauth_client_display_name_title'] = array(
    '#markup' => '<b>Login link on the login page:</b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext"><b>Note:</b> The login link will appear on the user login page in this manner</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_display_name'] = array(
    '#type' => 'textfield',
    '#id' => 'miniorange_oauth_client_display_name',
    '#default_value' => variable_get('miniorange_auth_client_display_name', 'Login using ##app_name##'),
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['miniorange_oauth_client_id_title'] = array(
    '#markup' => '<b>Client ID: </b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext">You will get this value from your OAuth Server</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_id'] = array(
    '#type' => 'textfield',
    '#id' => 'miniorange_oauth_client_client_id',
    '#default_value' => variable_get('miniorange_auth_client_client_id', NULL),
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['miniorange_oauth_client_secret_title'] = array(
    '#markup' => '<b>Client Secret: </b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext">You will get this value from your OAuth Server</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_secret'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('miniorange_auth_client_client_secret', NULL),
    '#id' => 'miniorange_oauth_client_client_secret',
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['mo_vt_id_data2'] = array(
    '#markup' => '</div><div id = "mo_vt_add_data2">',
  );
  $form['miniorange_oauth_client_scope_title'] = array(
    '#markup' => '<b>Scope: </b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext">Scope decides the range of data that you will be getting from your OAuth Provider</div>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_scope'] = array(
    '#type' => 'textfield',
    '#id' => 'miniorange_oauth_client_scope',
    '#default_value' => variable_get('miniorange_auth_client_scope', NULL),
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['mo_vt_id_data3'] = array(
    '#markup' => '</div><div id = "mo_vt_add_data5">',
  );
  $form['miniorange_oauth_client_authorize_endpoint_title'] = array(
    '#markup' => '<b>Authorize Endpoint: </b>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_authorize_endpoint'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('miniorange_auth_client_authorize_endpoint', NULL),
    '#id' => 'miniorange_oauth_client_auth_ep',
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['miniorange_oauth_client_access_token_endpoint_title'] = array(
    '#markup' => '<b>Access Token Endpoint:</b> ',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_access_token_endpoint'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('miniorange_auth_client_access_token_ep', NULL),
    '#id' => 'miniorange_oauth_client_access_token_ep',
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['miniorange_oauth_client_userinfo_endpoint_title'] = array(
    '#markup' => '<b>Get User Info Endpoint: </b>',
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['miniorange_oauth_client_userinfo_endpoint'] = array(
    '#type' => 'textfield',
    '#default_value' => variable_get('miniorange_auth_client_user_info_ep', NULL),
    '#id' => 'miniorange_oauth_client_user_info_ep',
    '#attributes' => array(
      'style' => 'width:73%',
    ),
    '#prefix' => $prefixvalue,
    '#suffix' => $suffixvalue,
  );
  $form['background_2'] = array(
    '#markup' => t('<b>Send Client ID and secret in: </b> <div class="mo_oauth_tooltip"><img src="' . $base_url . '/' . $module_path . '/includes/images/info.png" alt="info icon" height="15px" width="15px"></div><div class="mo_oauth_tooltiptext"><b>Note:</b> This option depends upon the OAuth provider. In case you are unaware about what to save, keeping this default is the best practice.</div>'),
    '#prefix' => $prefixname,
    '#suffix' => $suffixname,
  );
  $form['background_1'] = array(
    '#markup' => "<div class='mo_oauth_highlight_background_note_2'>",
    '#prefix' => $prefixvalue,
  );
  $form['miniorange_oauth_send_with_header_oauth'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('miniorange_oauth_send_with_header_oauth', 1),
    '#title' => t('<b>Header</b>'),
  );
  $form['miniorange_oauth_send_with_body_oauth'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('miniorange_oauth_send_with_body_oauth'),
    '#title' => t('<b>Body</b>'),
  );
  $form['background_1_end'] = array(
    '#markup' => '</div>',
    '#suffix' => $suffixvalue,
  );
  $form['mo_vt_id_data4'] = array(
    '#markup' => '</div><br><div id = "mo_vt_add_data4">',
  );
  $form['miniorange_oauth_enable_login_with_oauth'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('miniorange_oauth_enable_login_with_oauth', 1),
    '#title' => t('<b>Enable login with OAuth</b>'),
  );
  $form['mo_btn_breaks'] = array(
    '#markup' => "</div><br>",
  );
  $disable_true = "";
  $disableval = False;
  $miniorange_auth_client_client_id = variable_get('miniorange_auth_client_client_id', NULL);
  $miniorange_auth_client_client_secret = variable_get('miniorange_auth_client_client_secret', NULL);
  $miniorange_auth_client_authorize_endpoint = variable_get('miniorange_auth_client_authorize_endpoint', NULL);
  $miniorange_auth_client_access_token_ep = variable_get('miniorange_auth_client_access_token_ep', NULL);
  $miniorange_auth_client_user_info_ep = variable_get('miniorange_auth_client_user_info_ep', NULL);
  if (empty($miniorange_auth_client_client_id) || empty($miniorange_auth_client_client_secret) || empty($miniorange_auth_client_authorize_endpoint) || empty($miniorange_auth_client_access_token_ep) || empty($miniorange_auth_client_user_info_ep)) {
    $disable_true = 'disabled="True"';
    $disableval = TRUE;
  }
  $form['miniorange_oauth_client_config_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save Configuration'),
    '#submit' => array(
      'miniorange_oauth_client_save_config',
    ),
    '#id' => 'button_config',
  );
  $form['miniorange_oauth_client_test_config_button'] = array(
    '#id' => 'miniorange_oauth_client_test_config_button',
    '#markup' => '<a ' . $disable_true . ' class="btn btn-primary-color btn-large" style="padding:4px 8px;margin-right:14px;margin-bottom: 4px;" onclick="testConfig(\'' . getTestUrl() . '\');">' . 'Test Configuration</a>',
  );
  $form['miniorange_oauth_client_reset_config_button'] = array(
    '#type' => 'submit',
    '#id' => 'button_config',
    '#value' => t('Reset Configuration'),
    '#disabled' => $disableval,
    '#submit' => array(
      'miniorange_oauth_client_reset_config',
    ),
    '#attributes' => array(
      'style' => 'color: #fff;background-color: #d7342e;
                                        text-shadow: 0 -1px 1px #d7342e, 1px 0 1px #d7342e, 0 1px 1px #d7342e, -1px 0 1px #d7342e;box-shadow: 0 1px 0 #d7342e;border-color: #d7342e;',
    ),
  );
  $form['miniorange_oauth_login_link'] = array(
    '#id' => 'miniorange_oauth_login_link',
    '#markup' => "<br><br><div style='background-color: rgba(173,216,230,0.3); padding: 15px;font-family: sans-serif '>\n            <br><div style='font-size: 1.3em;'> <strong>Instructions to add login link to different pages in your Drupal site: <br><br></strong></div>\n            <div style='font-size: 1.1em;'>After completing your configurations, by default you will see a login link on your drupal site's login page. However, if you want to add login link somewhere else, please follow the below given steps:</div>\n            <div style='padding-left: 15px;padding-top:5px;'>\n            <div style='font-size: 0.9em;'>\n            <li style='padding: 3px'>Go to <b>Structure</b> -> <b>Blocks</b></li>\n            <li style='padding: 3px'> Click on <b>Add block</b></li>\n            <li style='padding: 3px'>Enter <b>Block Title</b> and the <b>Block description</b></li>\n            <li style='padding: 3px'>Under the <b>Block body</b> enter the following URL:\n                <ol><pre>&lt;a href=&lt;your domain&gt;/?q=moLogin&lt;enter text you want to show on the link&lt;/a&gt;</pre></ol>\n                <ol>For example: If your domain name is <b>https://www.miniorange.com</b> then, enter: <b>&lt;a href= 'https://www.miniorange.com/?q=moLogin'&gt Click here to Login&lt;/a&gt;</b> in the <b>Block body</b> textfield </ol>\n            </li>\n            <li style='padding: 3px'>From the text filtered dropdown select either <b>Filtered HTML</b> or <b>Full HTML</b></li>\n            <li style='padding: 3px'>From the division under <b>REGION SETTINGS</b> select where do you want to show the login link</li>\n            <li style='padding: 3px'>Click on the <b>SAVE block</b> button to save your settings</li><br>\n            </div>\n        </div>\n    </div>",
    '#attributes' => array(),
  );
  $form['miniorange_oauth_break'] = array(
    '#markup' => '<br><br>',
  );
  $form['mo_ma_div_close'] = array(
    '#markup' => '</div></div>',
  );
  Utilities::spConfigGuide($form, $form_state);
  $form['mo_ma_1_div_close'] = array(
    '#markup' => '</div>',
  );
  Utilities::advertiseServer($form, $form_state);
  $form['mo_markup_div_imp'] = array(
    '#markup' => '</div>',
  );
  Utilities::AddSupportButton($form, $form_state);
  $form['mo_markup_div_imp'] = array(
    '#markup' => '</div>',
  );
  $form['miniorange_oauth_client_config_button'] = array(
    '#markup' => "<script>\n                            jQuery(document).ready(function() {\n                            var v=document.getElementById('miniorange_oauth_client_app');\n                            var i;\n                            for (i = 18; i < 24; i++) {\n                                v.options[i].disabled=true;\n                            }\n                            jQuery('.form-item-miniorange-oauth-client-facebook-instr').show();\n                            jQuery('.form-item-miniorange-oauth-client-eve-instr').hide();\n                            jQuery('.form-item-miniorange-oauth-client-google-instr').hide();\n                            jQuery('.form-item-miniorange-oauth-client-other-instr').hide();\n                            jQuery('.form-item-miniorange-oauth-client-strava-instr').hide();\n                            jQuery('.form-item-miniorange-oauth-client-fitbit-instr').hide();\n                            jQuery('#miniorange_oauth_client_app').parent().show();\n                            jQuery('#miniorange_oauth_client_app').change(function()\n                            {\n                                var appname = document.getElementById('miniorange_oauth_client_app').value;\n                                var callbackUrl = document.getElementById('callbackurl').value;\n                                if(appname == 'Azure AD'){\n                                    callbackUrl = callbackUrl.replace(/^http:\\/\\//i, 'https://');\n                                    document.getElementById('callbackurl').value=callbackUrl;\n                                }\n                                else\n                                    document.getElementById('callbackurl').value=callbackUrl;\n\n                            if(appname=='Facebook' || appname=='Google' || appname=='Okta_oauth' || appname=='Slack' || appname=='Zendesk' || appname=='Box' || appname=='Github' || appname=='Wild Apricot' || appname=='Salesforce' || appname=='LinkedIn' || appname=='Azure AD' || appname=='Keycloak' || appname=='Custom' || appname=='Strava' || appname=='FitBit' || appname=='Discord' || appname=='Line'){\n                                    jQuery('#mo_oauth_app_name_div').parent().show();\n                                    jQuery('#miniorange_oauth_client_app_name').parent().show();\n                                    jQuery('#miniorange_oauth_client_display_name').parent().show();\n                                    jQuery('#miniorange_oauth_client_client_id').parent().show();\n                                    jQuery('#miniorange_oauth_client_client_secret').parent().show();\n                                    jQuery('#miniorange_oauth_client_scope').parent().show();\n                                    jQuery('#miniorange_oauth_login_link').parent().show();\n                                    jQuery('#test_config_button').show();\n                                    jQuery('#callbackurl').parent().show();\n                                    jQuery('#mo_oauth_authorizeurl').attr('required','true');\n                                    jQuery('#mo_oauth_accesstokenurl').attr('required','true');\n                                    jQuery('#mo_oauth_resourceownerdetailsurl').attr('required','true');\n                                    jQuery('#miniorange_oauth_client_auth_ep').parent().show();\n                                    jQuery('#miniorange_oauth_client_access_token_ep').parent().show();\n                                    jQuery('#miniorange_oauth_client_user_info_ep').parent().show();\n\n                                    if(appname=='Facebook'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='email';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://www.facebook.com/dialog/oauth';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://graph.facebook.com/v2.8/oauth/access_token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://graph.facebook.com/me/?fields=id,name,email,age_range,first_name,gender,last_name,link&access_token=';\n                                }else if(appname=='Google'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='email+profile';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://accounts.google.com/o/oauth2/auth';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://www.googleapis.com/oauth2/v4/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://www.googleapis.com/oauth2/v1/userinfo';\n                                }else if(appname=='LinkedIn'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='r_basicprofile';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://www.linkedin.com/oauth/v2/authorization';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://www.linkedin.com/oauth/v2/accessToken';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.linkedin.com/v2/me';\n                                }else if(appname=='Salesforce'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='id';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://login.salesforce.com/services/oauth2/authorize';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://login.salesforce.com/services/oauth2/token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://login.salesforce.com/services/oauth2/userinfo';\n                                }else if(appname=='Wild Apricot'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='auto';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://{your_account_url}/sys/login/OAuthLogin';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://oauth.wildapricot.org/auth/token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.wildapricot.org/v2.1/accounts/{account_id}/contacts/me';\n                                }else if(appname=='Azure AD'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='openid';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://login.microsoftonline.com/[tenant-id]/oauth2/authorize';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://login.microsoftonline.com/[tenant-id]/oauth2/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://login.windows.net/common/openid/userinfo';\n                                }else if(appname=='Keycloak'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='email profile';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='{Keycloak_base_URL}/realms/{realm-name}/protocol/openid-connect/auth';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='{Keycloak_base_URL}/realms/{realm-name}/protocol/openid-connect/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='{Keycloak_base_URL}/realms/{realm-name}/protocol/openid-connect/userinfo';\n                                }else if(appname=='Custom'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='email profile';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='';\n                                } else if(appname=='Strava'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='public';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://www.strava.com/oauth/authorize';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://www.strava.com/oauth/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://www.strava.com/api/v3/athlete';\n                                }else if(appname=='FitBit'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='profile';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://www.fitbit.com/oauth2/authorize';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://api.fitbit.com/oauth2/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.fitbit.com/1/user/-/profile.json';\n                                }else if(appname=='Discord'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='identify email';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://discordapp.com/api/oauth2/authorize';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://discordapp.com/api/oauth2/token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://discordapp.com/api/users/@me';\n                                }else if(appname=='Line'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='Profile openid email';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://access.line.me/oauth2/v2.1/authorize';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://api.line.me/oauth2/v2.1/token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.line.me/ v2/profile';\n                                }else if(appname=='Zendesk'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='read write';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://{subdomain}.zendesk.com/oauth/authorizations/new';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://{subdomain}.zendesk.com/oauth/tokens';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://{subdomain}.zendesk.com/api/v2/users';\n                                }else if(appname=='Box'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='root_readwrite';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://account.box.com/api/oauth2/authorize';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://api.box.com/oauth2/token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.box.com/2.0/users/me';\n                                }else if(appname=='Github'){\n                                  document.getElementById('miniorange_oauth_client_scope').value='user repo';\n                                  document.getElementById('miniorange_oauth_client_auth_ep').value='https://github.com/login/oauth/authorize';\n                                  document.getElementById('miniorange_oauth_client_access_token_ep').value='https://github.com/login/oauth/access_token';\n                                  document.getElementById('miniorange_oauth_client_user_info_ep').value='https://api.github.com/user';\n                                }else if(appname=='Slack'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='users.profile:read';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://slack.com/oauth/authorize';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://slack.com/api/oauth.access';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://slack.com/api/users.profile.get';\n                                }else if(appname=='Okta_oauth'){\n                                    document.getElementById('miniorange_oauth_client_scope').value='openid email profile';\n                                    document.getElementById('miniorange_oauth_client_auth_ep').value='https://{yourOktaDomain}.com/oauth2/default/v1/authorize';\n                                    document.getElementById('miniorange_oauth_client_access_token_ep').value='https://{yourOktaDomain}.com/oauth2/default/v1/token';\n                                    document.getElementById('miniorange_oauth_client_user_info_ep').value='https://{yourOktaDomain}.com/oauth2/default/v1/userinfo';\n                                }\n                                }\n                            })\n                        }\n                        );\n                </script>",
  );
  return $form;
}