function pbs_passport_authenticate_activation()
{
    // init the object, which will setup the object
    $plugin_obj = new PBS_Passport_Authenticate(__FILE__);
    $plugin_obj->setup_rewrite_rules();
    flush_rewrite_rules();
}
<?php

$defaults = get_option('pbs_passport_authenticate');
$passport = new PBS_Passport_Authenticate(dirname(__FILE__));
wp_enqueue_script('pbs_passport_loginform_js', $passport->assets_url . 'js/loginform_helpers.js', array('jquery'), $passport->version, true);
$links = $passport->get_oauth_links();
$pluginImageDir = $passport->assets_url . 'img';
$station_nice_name = $defaults['station_nice_name'];
$laas_client = $passport->get_laas_client();
$userinfo = $laas_client->check_pbs_login();
$membership_id = !empty($_REQUEST['membership_id']) ? $_REQUEST['membership_id'] : false;
if ($membership_id) {
    $mvault_client = $passport->get_mvault_client();
    $mvaultinfo = $mvault_client->get_membership($membership_id);
    if (empty($mvaultinfo['first_name'])) {
        // then the membership_id is invalid so discard it
        $membership_id = false;
    } else {
        foreach ($links as $type => $link) {
            //$jwt = json_encode(array("membership_id" => $membership_id));
            // for now lets just pass the membership_id
            $jwt = $membership_id;
            $links[$type] = $link . "&state=" . $jwt;
        }
    }
}
get_header();
?>
<div class='pbs-passport-authenticate-wrap <?php 
if (empty($userinfo) && !$membership_id) {
    echo "wide";
<?php

/*
activate.php
*/
show_admin_bar(false);
get_header();
$passport = new PBS_Passport_Authenticate(dirname(__FILE__));
$pluginImageDir = $passport->assets_url . 'img';
$defaults = get_option('pbs_passport_authenticate');
$station_nice_name = $defaults['station_nice_name'];
// this script only takes one possible argument
$activation_token = !empty($_REQUEST['activation_token']) ? str_replace(' ', '-', trim($_REQUEST['activation_token'])) : '';
if ($activation_token) {
    $mvaultinfo = $passport->lookup_activation_token($activation_token);
    $return = array();
    if (empty($mvaultinfo['membership_id'])) {
        $return['errors'] = 'This activation code is invalid';
    } else {
        // this is a theoretically valid token.
        if ($mvaultinfo['status'] != 'On') {
            $return['errors'] = 'This account has been disabled';
        }
        if (!empty($mvaultinfo['activation_date'])) {
            $return['errors'] = 'This activation code has already been used. <br />You only need to activate once for access.';
        }
        if (empty($return['errors'])) {
            // nothing wrong with this account, so
            // see if we're already logged in
            $laas_client = $passport->get_laas_client();
            $userinfo = $laas_client->check_pbs_login();
/*
oauthcallback.php

This script handles the oAuth grant 'code' that is returned from the provider
(google/fb/openid), and calls the 'authenticate' method of the PBS_LAAS_Client.  
That method exchanges the grant 'code' with PBS's endpoints to get access and refresh tokens, 
uses those to get user info (email, name, etc), and then stores the tokens and userinfo encrypted 
in session variables.   
If the 'rememberme' variable was true, those tokens are also stored in an encrypted cookie.
*/
show_admin_bar(false);
remove_all_actions('wp_footer', 1);
remove_all_actions('wp_header', 1);
$defaults = get_option('pbs_passport_authenticate');
$passport = new PBS_Passport_Authenticate(dirname(__FILE__));
$laas_client = $passport->get_laas_client();
if (isset($_GET["state"])) {
    $state = $_GET["state"];
}
// this WILL be JWT, for now its just the membership_id
// $jwt = $passport->jwt_decode($state);
$membership_id = !empty($state) ? $state : false;
$rememberme = false;
if (!empty($_COOKIE["pbsoauth_rememberme"])) {
    $rememberme = $_COOKIE["pbsoauth_rememberme"];
}
// nonce is going to be in the jwt
$nonce = false;
$errors = array();
if (isset($_GET["code"])) {