<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[11498] sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php: Official WordPress Events: During the Meetup.com REST API > GraphQL migration, part of the authentication layer was deactivated, switch authentication methods.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/11498">11498</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/11498","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-02-01 05:14:25 +0000 (Tue, 01 Feb 2022)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Official WordPress Events: During the Meetup.com REST API > GraphQL migration, part of the authentication layer was deactivated, switch authentication methods.

This commit is very not-preferential-approach, but works, which is better than the code in production :)

A human is required to go through the oAuth flow, rather than letting the code perform the login, which is why this is somewhat ugly.

See https://github.com/WordPress/wordcamp.org/issues/697</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupoauth2clientphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsofficialwordpresseventsmeetupclassmeetupoauth2clientphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php  2022-02-01 02:58:47 UTC (rev 11497)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/meetup/class-meetup-oauth2-client.php    2022-02-01 05:14:25 UTC (rev 11498)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,9 +71,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="cx" style="display: block; padding: 0 10px">         * @var string
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        const SITE_OPTION_KEY_OAUTH = 'meetup_oauth_token';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const SITE_OPTION_KEY_OAUTH = 'meetup_access_token';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @var string
+        */
+       const SITE_OPTION_KEY_AUTHORIZATION = 'meetup_oauth_authorization';
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @var array
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected $oauth_token = array();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -121,66 +126,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Step 1 in "Server Flow with User Credentials".
-        *
-        * @see https://www.meetup.com/meetup_api/auth/#oauth2servercredentials-auth
-        *
-        * @return array
-        */
-       protected function request_authorization_code() {
-               $authorization_code = array();
-
-               $request = array(
-                       'client_id'     => self::CONSUMER_KEY,
-                       'redirect_uri'  => self::REDIRECT_URI,
-                       'response_type' => 'anonymous_code',
-               );
-
-               $args = array(
-                       'headers' => $this->get_headers(),
-                       'body'    => $request,
-               );
-
-               $response = $this->tenacious_remote_post( self::URL_AUTHORIZE, $args );
-
-               if ( 200 === wp_remote_retrieve_response_code( $response ) ) {
-                       $body = json_decode( wp_remote_retrieve_body( $response ), true );
-
-                       if ( ! empty( $body['code'] ) ) {
-                               $authorization_code = $body;
-                       } else {
-                               $this->error->add(
-                                       'unexpected_oauth_authorization_code_response',
-                                       'The Meetup OAuth API response did not provide the expected data.'
-                               );
-                       }
-               } else {
-                       $this->handle_error_response( $response );
-               }
-
-               return $authorization_code;
-       }
-
-       /**
</del><span class="cx" style="display: block; padding: 0 10px">          * Request one of various types of tokens from the Meetup OAuth API.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * 
+        * Setting $type to 'access_token' is for step 2 of the oAuth flow. This takes a code that has been previously set
+        * through a user-initiated oAuth authentication.
+        * 
+        * Setting $type to 'refresh_token' will request a new access_token generated through the above access_token method.
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Setting $type to 'server_token' is for Step 2 in "Server Flow with User Credentials". This gets the "server
-        * access token" which is then used to request the "oauth access token".
-        * @see https://www.meetup.com/meetup_api/auth/#oauth2servercredentials-access
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @see https://www.meetup.com/api/authentication/#p02-server-flow-section
</ins><span class="cx" style="display: block; padding: 0 10px">          *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * Setting $type to 'oauth_token' is for Step 3 in "Server Flow with User Credentials". Technically in the
-        * documentation, this token is also called an "access token", but here we're calling it the "oauth access token" to
-        * differentiate it from the "server access token". Also, why are two separate access tokens necessary??
-        * @see https://www.meetup.com/meetup_api/auth/#oauth2servercredentials-accesspro
-        *
-        * Setting $type to 'refresh_token' will request a new server access token for Step 2. This is for when the oauth
-        * token from Step 3 is expired. The refreshed server token can then be used to obtain a new Step 3
-        * oauth token. This skips the authorization code request (Step 1), but seems largely superfluous since a second
-        * oauth token request must still be made with the new server token. Also, the refresh_token string used to refresh
-        * the server token needs to come from the oauth token array, **not the server token array**. This is not what the
-        * documentation implies. Why is this so terrible??
-        * @see https://www.meetup.com/meetup_api/auth/#oauth2server-refresh
-        *
</del><span class="cx" style="display: block; padding: 0 10px">          * Check the `get_oauth_token` method to see how these token request flows work.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param string $type The type of token request. 'server_token', 'refresh_token', or 'oauth_token'.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,7 +150,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $request_body    = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                switch( $type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        case 'server_token': // Request a new server access token.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 case 'access_token': // Request a new access token.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $args = wp_parse_args( $args, array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'code' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,12 +159,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $request_body = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'client_id'     => self::CONSUMER_KEY,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'client_secret' => self::CONSUMER_SECRET,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        'grant_type'    => 'authorization_code',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'redirect_uri'  => self::REDIRECT_URI,
</span><span class="cx" style="display: block; padding: 0 10px">                                        'code'          => $args['code'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'grant_type'    => 'anonymous_code',
</del><span class="cx" style="display: block; padding: 0 10px">                                 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                $request_headers['Content-Type'] = 'application/x-www-form-urlencoded';
</ins><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        case 'refresh_token': // Refresh a server access token.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+                       case 'refresh_token': // Refresh an access token.
</ins><span class="cx" style="display: block; padding: 0 10px">                                 $args = wp_parse_args( $args, array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'refresh_token' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -223,18 +179,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        'grant_type'    => 'refresh_token',
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        case 'oauth_token': // Request a new oauth token.
-                               $args = wp_parse_args( $args, array(
-                                       'access_token' => '',
-                               ) );
-
-                               $request_url     = self::URL_OAUTH_TOKEN;
-                               $request_headers = $this->get_headers( $args['access_token'] );
-                               $request_body    = array(
-                                       'email'    => self::EMAIL,
-                                       'password' => self::PASSWORD,
-                               );
-                               break;
</del><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $request_args = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -280,46 +224,60 @@
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function get_oauth_token() {
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $this->oauth_token && ! $this->is_expired_token( $this->oauth_token ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        return $this->oauth_token['oauth_token'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 return $this->oauth_token['access_token'];
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $oauth_token   = '';
-               $needs_caching = false;
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $token = get_site_option( self::SITE_OPTION_KEY_OAUTH, array() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! $this->is_valid_token( $token, 'oauth_token' ) ) {
-                       $authorization = $this->request_authorization_code(); // Step 1.
-                       $server_token  = $this->request_token( 'server_token', $authorization ); // Step 2.
-                       $token         = $this->request_token( 'oauth_token', $server_token ); // Step 3.
-                       $needs_caching = true;
-               } elseif ( $this->is_expired_token( $token ) ) {
-                       $server_token = $this->request_token( 'refresh_token', $token ); // Alternate for Steps 1 & 2.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! $this->is_valid_token( $token, 'access_token' ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // If the token is no longer valid but "looked valid" fetch a fresh one.
-                       if ( ! $server_token && $this->error->get_error_message( 'oauth_error' ) ) {
-                               $this->error->remove( 'oauth_error' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // At this point, we need to get a new oAuth done.
+                       if ( empty( $_GET['code'] ) ) {
+                               $_GET['code'] = get_site_option( self::SITE_OPTION_KEY_AUTHORIZATION, false );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                // The token isn't valid for refreshing, request a new one.
-                               $authorization = $this->request_authorization_code(); // Step 1.
-                               $server_token  = $this->request_token( 'server_token', $authorization ); // Step 2.
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         if ( ! $_GET['code'] ) {
+                                       $message = sprintf(
+                                               "Meetup.com oAuth expired. Please access the following url while logged into the %s meetup.com account: \n\n%s\n\n" . 
+                                               "For sites other than WordCamp Central, the ?code=... parameter will need to be stored on this site via wp-cli and this task run again: `wp --url=%s site option update '%s' '...'`",
+                                               self::EMAIL,
+                                               sprintf(
+                                                       'https://secure.meetup.com/oauth2/authorize?client_id=%s&response_type=code&redirect_uri=%s&state=meetup-oauth',
+                                                       self::CONSUMER_KEY,
+                                                       self::REDIRECT_URI
+                                               ),
+                                               network_site_url('/'),
+                                               self::SITE_OPTION_KEY_AUTHORIZATION
+                                       );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $token         = $this->request_token( 'oauth_token', $server_token ); // Step 3.
-                       $needs_caching = true;
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 if ( admin_url( '/' ) === self::REDIRECT_URI ) {
+                                               printf( '<div class="notice notice-error"><p>%s</p></div>', nl2br( make_clickable( $message ) ) );
+                                       }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( $this->is_valid_token( $token, 'oauth_token' ) ) {
-                       $this->oauth_token = $token;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 trigger_error( $message, E_USER_WARNING );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( $needs_caching ) {
-                               update_site_option( self::SITE_OPTION_KEY_OAUTH, $token );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 return false;
+                               }
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $oauth_token = $this->oauth_token['oauth_token'];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $token = $this->request_token( 'access_token', array( 'code' => $_GET['code'] ) );
+
+                       if ( $this->is_valid_token( $token, 'access_token' ) ) {
+                               delete_site_option( self::SITE_OPTION_KEY_AUTHORIZATION, false );
+                       }
+
+               } elseif ( $this->is_expired_token( $token ) ) {
+                       $token = $this->request_token( 'refresh_token', $token );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                return $oauth_token;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! $this->is_valid_token( $token, 'access_token' ) ) {
+                       return false;
+               }
+
+               $this->oauth_token = $token;
+
+               update_site_option( self::SITE_OPTION_KEY_OAUTH, $this->oauth_token );
+
+               return $this->oauth_token['access_token'];
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -332,7 +290,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return void
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function reset_oauth_token() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                delete_site_option( self::SITE_OPTION_KEY_OAUTH );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // NO. JUST NO. Do not delete the oAuth token.
+               // This is temporarily disabled while Meetup.com server-to-server authentication is unavailable.
+               // delete_site_option( self::SITE_OPTION_KEY_OAUTH );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->oauth_token = array();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->error       = new WP_Error();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -349,7 +309,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected function is_valid_token( $token, $type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $valid_types = array( 'server_token', 'refresh_token', 'oauth_token' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $valid_types = array( 'refresh_token', 'access_token' );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! is_array( $token ) || ! in_array( $type, $valid_types, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -356,16 +316,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        case 'server_token':
</del><span class="cx" style="display: block; padding: 0 10px">                         case 'refresh_token':
</span><span class="cx" style="display: block; padding: 0 10px">                                $required_properties = array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'access_token' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        case 'oauth_token':
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 case 'access_token':
</ins><span class="cx" style="display: block; padding: 0 10px">                         default:
</span><span class="cx" style="display: block; padding: 0 10px">                                $required_properties = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'oauth_token'   => '',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'access_token'   => '',
</ins><span class="cx" style="display: block; padding: 0 10px">                                         'refresh_token' => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                        'expires_in'    => '',
</span><span class="cx" style="display: block; padding: 0 10px">                                );
</span></span></pre>
</div>
</div>

</body>
</html>