Jump to content

Provisioning Module issue: ServiceSingleSignOn hook is not working


Tejas

Recommended Posts

SeviceSingleSignOn Core module function not redirecting on new tab.

Instead of its printing the variable in the same tab.

code :

function myModule_ServiceSingleSignOn(array $params) {
    $return = array(
		'success' => false,
	);
    try {
        if($params['domain'] == ''){
            throw new Exception('domain cannot be blank');
            return false;
         }
        // Call the service's single sign-on token retrieval function, using the
        // values provided by WHMCS in $params.
        $data = [
            'customerId'=> $params['clientsdetails']['userid'],
            'domainName'=> $params['domain'],
            'orderId'=> strval($params['serviceid']),
            'exp'=> time()+60*5

        ];
        $token = generateJWT($data , $params['serverpassword']);
        $controlPanelUrl = constant('CONTROL_PANEL_PATH');
        return array(
            'success' => true,
            'redirectTo' => $controlPanelUrl.'?partnerId='.$params["serverusername"].'&jwt='.$token
        );
    } catch (Exception $e) {
        // Record the error in WHMCS's module log.
        logModuleCall(
            'flockcloudmodule',
            __FUNCTION__,
            $params,
            $e->getMessage(),
            $e->getTraceAsString()
        );

        return array(
            'success' => false,
            'errorMsg' => $e->getMessage(),
        );
    }
}

 

Screen Shot 2019-09-05 at 1.44.33 PM.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated