Changeset 1876970
- Timestamp:
- 05/18/2018 08:10:30 AM (8 years ago)
- Location:
- alive5/trunk
- Files:
-
- 2 edited
-
admin/class-alive5-admin-settings.php (modified) (4 diffs)
-
public/class-alive5-public.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
alive5/trunk/admin/class-alive5-admin-settings.php
r1773974 r1876970 54 54 $defaults = array( 55 55 'a5_auth_url' => 'https://api.alive5.com/1.0/authuser', 56 'a5_widgets_url' => 'https://api.alive5.com/1.0/ org/get-widgets'56 'a5_widgets_url' => 'https://api.alive5.com/1.0/widget-code/get-all' 57 57 ); 58 58 … … 161 161 return false; 162 162 } 163 $request = wp_remote_get("$a5_widgets_url"); 163 $a5_jwt = get_option('a5_jwt'); 164 $request = wp_remote_get("$a5_widgets_url", array( 165 'headers' => array( 166 'authorization' => $a5_jwt 167 ) 168 )); 164 169 if (is_wp_error($request)) { 170 // var_dump($request); 165 171 echo '<h2 style="color: red;">Error occured while fetching widgets, check settings</h2>'; 166 172 return false; … … 203 209 $defaults = $this->alive5_defaults(); 204 210 $a5_auth_creds = get_option('a5_settings'); 205 $auth_url = $defaults['a5_auth_url'].'?org_name='.$a5_auth_creds['a5_org_name'].'&email='.$a5_auth_creds['a5_username'].'&password='.$a5_auth_creds['a5_password']; 206 $request = wp_remote_get("$auth_url"); 211 // $auth_url = $defaults['a5_auth_url'].'?org_name='.$a5_auth_creds['a5_org_name'].'&email='.$a5_auth_creds['a5_username'].'&password='.$a5_auth_creds['a5_password']; 212 $request = wp_remote_post($defaults['a5_auth_url'], array( 213 'body' => array( 214 'org_name' => $a5_auth_creds['a5_org_name'], 215 'email' => $a5_auth_creds['a5_username'], 216 'password' => $a5_auth_creds['a5_password'] 217 ) 218 )); 207 219 208 220 if( is_wp_error( $request ) ) { … … 211 223 $body = wp_remote_retrieve_body($request); 212 224 $data = json_decode($body); 225 // print_r($data); 213 226 if (!empty($data->data->jwt)) { 214 227 add_option('a5_jwt', $data->data->jwt); -
alive5/trunk/public/class-alive5-public.php
r1773974 r1876970 107 107 $options = get_option('a5_settings'); 108 108 $jwt = get_option('a5_jwt'); 109 $url = 'https://api.alive5.com/1.0/ org/widget?org_name='.$options['a5_org_name'].'&widget_id='.$widget['widget_id'];110 $args = array( 'Authorization' => $jwt);109 $url = 'https://api.alive5.com/1.0/widget-code/get-by-id?org_name='.$options['a5_org_name'].'&widget_id='.$widget['widget_id']; 110 $args = array( 'headers' => array('authorization' => $jwt)); 111 111 $request = wp_remote_get("$url", $args); 112 112
Note: See TracChangeset
for help on using the changeset viewer.