Zoom Api Access Token expire And Refresh Token generation not Working - codeigniter

I am trying to integrate Zoom with my CodeIgneter application using API with OAuth method. I created an Access Token and integrated my Zoom account with my application successfully.
After 1 hr the Zoom account access key expired.
In the Zoom API document it says that after 1 hr the access token will expire and after that we can generate an access token using Refresh Token.
Used Document: OAuth Document:-
I am creating a function to create an access token after expired by using the refresh token.
My Code is:
$clients = new GuzzleHttp\Client(['base_uri' => 'https://zoom.us']);
$arr_tokens = $this->get_access_token();
$refresh_tokens = $arr_tokens->refresh_token;
$response = $clients->request('POST', '/oauth/token', [
"headers" => [
"Authorization" => "Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
],
'form_params' => [
"grant_type" => "refresh_token",
"refresh_token" => $refresh_tokens
],
]);
Here $refresh_tokens have my refresh token.CLIENT_ID and CLIENT_SECRET are my client id and client secret key.
I am trying this code and printed the response. But the response is not similar to what I expected. There is no access token or refresh token.
Expected response:
{
"access_token": "eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI8S0lEPiJ9.eyJ2ZXIiOiI2IiwiY2xpZW50SWQiOiI8Q2xpZW50X0lEPiIsImNvZGUiOiI8Q29kZT4iLCJpc3MiOiJ1cm46em9vbTpjb25uZWN0OmNsaWVudGlkOjxDbGllbnRfSUQ-IiwiYXV0aGVudGljYXRpb25JZCI6IjxBdXRoZW50aWNhdGlvbl9JRD4iLCJ1c2VySWQiOiI8VXNlcl9JRD4iLCJncm91cE51bWJlciI6MCwiYXVkIjoiaHR0cHM6Ly9vYXV0aC56b29tLnVzIiwiYWNjb3VudElkIjoiPEFjY291bnRfSUQ-IiwibmJmIjoxNTgwMTQ3Mzk0LCJleHAiOjE1ODAxNTA5OTQsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsImlhdCI6MTU4MDE0NzM5NCwianRpIjoiPEpUST4iLCJ0b2xlcmFuY2VJZCI6MjZ9.5c58p0PflZJdlz4Y7PgMIVCrQpHDnbM565iCKlrtajZ5HHmy00P5FCcoMwHb9LxjsUgbJ7653EfdeX5NEm6RoA",
"token_type": "bearer",
"refresh_token": "eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLCJraWQiOiI8S0lEPiJ9.eyJ2ZXIiOiI2IiwiY2xpZW50SWQiOiI8Q2xpZW50X0lEPiIsImNvZGUiOiI8Q29kZT4iLCJpc3MiOiJ1cm46em9vbTpjb25uZWN0OmNsaWVudGlkOjxDbGllbnRfSUQ-IiwiYXV0aGVudGljYXRpb25JZCI6IjxBdXRoZW50aWNhdGlvbl9JRD4iLCJ1c2VySWQiOiI8VXNlcl9JRD4iLCJncm91cE51bWJlciI6MCwiYXVkIjoiaHR0cHM6Ly9vYXV0aC56b29tLnVzIiwiYWNjb3VudElkIjoiPEFjY291bnRfSUQ-IiwibmJmIjoxNTgwMTQ3Mzk0LCJleHAiOjIwNTMxODczOTQsInRva2VuVHlwZSI6InJlZnJlc2hfdG9rZW4iLCJpYXQiOjE1ODAxNDczOTQsImp0aSI6IjxKVEk-IiwidG9sZXJhbmNlSWQiOjI2fQ.DwuqOzywRrQO2a6yp0K_6V-hR_i_mOB62flkr0_NfFdYsSqahIRRGk1GlUTQnFzHd896XDKf_FnSSvoJg_tzuQ",
"expires_in": 3599,
"scope": "user:read" }
Actual Response:
GuzzleHttp\Psr7\Response Object
[reasonPhrase:GuzzleHttp\Psr7\Response:private] => OK
[statusCode:GuzzleHttp\Psr7\Response:private] => 200
[headers:GuzzleHttp\Psr7\Response:private] => Array
(
[Date] => Array
(
[0] => Thu, 03 Sep 2020 12:58:09 GMT
)
[Content-Type] => Array
(
[0] => text/html;charset=utf-8
)
[Transfer-Encoding] => Array
(
[0] => chunked
)
[Connection] => Array
(
[0] => keep-alive
)
[Server] => Array
(
[0] => ZOOM
)
[x-zm-trackingid] => Array
(
[0] => WEB_af014e94c93acce064094d6fcc84cdcf
)
[X-Content-Type-Options] => Array
(
[0] => nosniff
)
[Content-Security-Policy] => Array
(
[0] => upgrade-insecure-requests; default-src https://*.zoom.us https://zoom.us https://d17o6on0vd932d.cloudfront.net blob: 'self'; script-src 'unsafe-eval' 'unsafe-inline' blob: about: https://ruanshi2.8686c.com https://ajax.aspnetcdn.com/ajax/3.5/MicrosoftAjax.js https://appsforoffice.microsoft.com https://assets.zendesk.com https://autocomplete.demandbase.com https://cdn.wootric.com https://cdncache-a.akamaihd.net https://connect.facebook.net https://consent.trustarc.com https://d.adroll.mgr.consensu.org https://d2b9h3rz4xo53c.cloudfront.net https://d24cgw3uvb9a9h.cloudfront.net https://googleads.g.doubleclick.net https://pi.pardot.com https://s.dcbap.com https://s.ytimg.com https://s3.amazonaws.com https://scout-cdn.salesloft.com https://sealserver.trustwave.com https://secure-cdn.mplxtms.com https://serve2.cheqzone.com https://snap.licdn.com https://sp.analytics.yahoo.com https://static.zdassets.com https://static2.sharepointonline.com https://tag.demandbase.com https://tpc.googlesyndication.com https://tracking.g2crowd.com https://trk.techtarget.com https://www.comeet.co https://www.dropbox.com https://www.google-analytics.com https://static.zoom.com.cn https://www.googleadservices.com/pagead/conversion_async.js https://www.googletagmanager.com/gtm.js https://optimize.google.com https://tagmanager.google.com https://www.gstatic.com/recaptcha/releases/ https://google.com https://docs.google.com https://cse.google.com https://maps.google.com https://www.google.com https://linkedin.com https://platform.linkedin.com https://px.ads.linkedin.com https://ads.linkedin.com https://www.youtube.com https://d17o6on0vd932d.cloudfront.net https://*.ada.support https://*.adroll.com https://*.hotjar.com https://*.zoom.us https://*.zoomcloudpbx.com https://*.zoomus.cn https://*.zopim.com https://adroll.com https://zoom.us https://apis.google.com https://gstatic.zoom.com.cn 'self'; img-src https: about: blob: data: 'self'; style-src https: safari-extension: chrome-extension: 'unsafe-inline' data: 'self'; font-src https: safari-extension: chrome-extension: blob: data: 'self'; connect-src * about: blob: data: 'self'; media-src * rtmp: blob: data: 'self'; frame-src https: ms-appx-web: zoommtg: zoomus: wvjbscheme: data: 'self'; object-src 'none'; base-uri 'none';
)
[X-FRAME-OPTIONS] => Array
(
[0] => SAMEORIGIN
)
[Set-Cookie] => Array
(
[0] => zm_aid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
[1] => zm_haid=""; Domain=.zoom.us; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly
[2] => cred=21ABCC12B70F62365DDF0B554A35C671; Path=/; Secure; HttpOnly
[3] => _zm_page_auth=us02_c_uEv-kiHgQvKAAar4F_rPWQ; Domain=.zoom.us; Path=/; Secure; HttpOnly
[4] => _zm_ssid=us02_c_aKIgfweHQQG5EaT2cZpweg; Domain=.zoom.us; Path=/; Secure; HttpOnly
[5] => _zm_ctaid=f889E52dRvqoURUKV2vCUg.1599137889254.83389fb9b0d366fa454e83b4f1b894ec; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[6] => _zm_chtaid=493; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[7] => _zm_ctaid=bksezrrWSqOKKGvcxDRklA.1599137889254.5f69b5a447060faa456f1bb911caa7f1; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[8] => _zm_chtaid=651; Domain=.zoom.us; Expires=Thu, 03-Sep-2020 14:58:09 GMT; Path=/; Secure; HttpOnly
[9] => _zm_csp_script_nonce=RodE7nd0SZSuAxPkY_1tLw; Domain=.zoom.us; Path=/; Secure; HttpOnly
[10] => _zm_currency=USD; Domain=.zoom.us; Expires=Fri, 04-Sep-2020 12:58:09 GMT; Path=/; Secure
[11] => _zm_mtk_guid=3a7d99ffa1474d8e837f0d7a34d285de; Domain=.zoom.us; Expires=Sun, 01-Sep-2030 12:58:09 GMT; Path=/; Secure
)
[p3p] => Array
(
[0] => CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
)
[Content-Language] => Array
(
[0] => en-US
)
[Strict-Transport-Security] => Array
(
[0] => max-age=31536000; includeSubDomains
)
[X-XSS-Protection] => Array
(
[0] => 1; mode=block
)
[Referrer-Policy] => Array
(
[0] => strict-origin-when-cross-origin
)
)
[headerNames:GuzzleHttp\Psr7\Response:private] => Array
(
[date] => Date
[content-type] => Content-Type
[transfer-encoding] => Transfer-Encoding
[connection] => Connection
[server] => Server
[x-zm-trackingid] => x-zm-trackingid
[x-content-type-options] => X-Content-Type-Options
[content-security-policy] => Content-Security-Policy
[x-frame-options] => X-FRAME-OPTIONS
[set-cookie] => Set-Cookie
[p3p] => p3p
[content-language] => Content-Language
[strict-transport-security] => Strict-Transport-Security
[x-xss-protection] => X-XSS-Protection
[referrer-policy] => Referrer-Policy
)
[protocol:GuzzleHttp\Psr7\Response:private] => 1.1
[stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #11
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
How to fix this issue.........????

"headers" => [
"Authorization" => "Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
]
-- You are providing this wrong, it should be like this "Basic Your base64encoded[clientid:clientsecret]", Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ= you don't need to pass this, It should be like this
"headers" => [
"Authorization" => "Basic ". base64_encode(CLIENT_ID.':'.CLIENT_SECRET)
]

Related

'email has been sent' massage is shown email is not receiving in CodeIgniter

i have use CodeIgniter 2.2.6
i am trying to sent email but i can't get error and not received email
<?php
class email_otp_demo extends CI_Controller
{
public function index()
{
$this->load->library('email');
$config = Array(
'protocol' => 'smpt',
'mailpath' => '/usr/sbin/sendmail,
//'mailpath' => 'www.google.com', also try
'smtp_host' => 'smtp.gmail.com',
'smtp_port' => 587,
//'smtp_port' => 456, also try
'smtp_user' => 'my.email#gmail.com',
'smtp_pass' => 'mypassword',
'smtp_timeout'=>50,
'mailtype' => 'text',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'newline' =>'\r\n'
);
// glnlwboynexfjqxj
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->set_crlf("\r\n");
$this->email->from('my.email#gmail.com', 'Social media website');
$this->email->to('sender#yahoo.com');
//$this->email->to('sender#gmail.com'); also try this
// $this->email->cc('another#another-example.com');
// $this->email->bcc('them#their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
echo $this->email->send();
echo "<hr>";
echo $this->email->print_debugger();
}
}
?>
i have get following output but not received email
1
Your message has been successfully sent using the following protocol: mail
User-Agent: CodeIgniter
Date: Sun, 4 Dec 2022 16:53:27 +0530
From: "Social media website" <renish.batada#gmail.com>
Return-Path: <renish.batada#gmail.com>
Reply-To: "renish.batada#gmail.com" <renish.batada#gmail.com>
X-Sender: renish.batada#gmail.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <638c832f6b8c0#gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
=?iso-8859-1?Q?Email_Test?=
Testing the email class.
i have also try to enable and disable to step verification
but not received email
i use app password and original password but not workworking

Laravel 7. How to download a file from server (FTP)?

I created a disk in config/filesystems.php file
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.domain.org',
'username' => 'username',
'password' => 'password',
'passive' => true,
'timeout' => 30,
'root' => '/',
'url' => '/'
],
The connection is tested and works. On the server this file exists:
$file_path = "/folder/aaa.txt";
But I can't download it! In the controller I wrote:
$file = Storage::disk('ftp')->download($file_path);
return response()->download($file);
And this is the outcome:
Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
The file "HTTP/1.0 200 OK Cache-Control: no-cache, private
Content-Disposition: attachment; filename=aaa.txt Content-Length: 0
Content-Type: text/plain Date: Fri, 10 Jul 2020 19:20:51 GMT"
does not exist
Additional issue
Instead of downloading it, how do I display the same file in the browser? The following code does not work in this case:
return response()->file($file_path);
Both response()->download($file) and Storage::download($file) will create a download response so you only need one of the two. Since your file is in remote storage you can just keep:
return Storage::disk('ftp')->download($file_path);
You can also customise the filename and headers. You can also (probably) make the file show inline by doing:
return Storage::disk('ftp')->download($file_path, 'any.txt', [
'Content-Disposition' => 'inline'
]);

Mailchimp API 403 Forbidden Error

I got various Websites that are accessing to Mailchimp API to subscribe addresses into Mailchimp Lists and getting Entries from there.
A few days ago, the API Calls are canceled due to a 403 Forbidden (Generic Error) when accessing a resource.
Error message:
Array
(
[headers] => Array
(
[url] => https://us8.api.mailchimp.com/3.0/lists/XXXXXXX/members?
[content_type] => text/html
[http_code] => 403
[header_size] => 170
[request_size] => 312
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0,292724
[namelookup_time] => 0,004255
[connect_time] => 0,018535
[pretransfer_time] => 0,161542
[size_upload] => 0
[size_download] => 162
[speed_download] => 553
[speed_upload] => 0
[download_content_length] => 162
[upload_content_length] => 0
[starttransfer_time] => 0,292685
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 104.83.97.93
[certinfo] => Array
(
)
[primary_port] => 443
[local_ip] => 80.74.145.2
[local_port] => 36488
[request_header] => GET /3.0/lists/XXXXXXX/members? HTTP/1.0
User-Agent: DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)
Host: us8.api.mailchimp.com
Accept-Encoding: deflate, gzip
Accept: application/vnd.api+json
Content-Type: application/vnd.api+json
Authorization: apikey XXXXXXXXXXXXXXXXXXXXXXXXXXX-us8
)
[httpHeaders] => Array
(
[Server] => openresty
[Content-Type] => text/html
[Content-Length] => 162
[Vary] => Accept-Encoding
[Date] => Tue, 05 Jun 2018 13:58:16 GMT
[Connection] => close
)
[body] => <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
Is Mailchimp blacklisting IP adresses? Because, when a clone the website to another IP Host the authentication works correctly.
If yes, is it possible to resolve the blacklisting, or at least monitor that issue?

getting error while sending email with multiple attachment in codeigniter

Code is working but can't send many files.... only images can be sended controller
public function sende(){
$from = $_POST['from'];
$address = $_POST['address'];
$to_name = $_POST['to_name'];
$to_email = $_POST['to_email'];
$cc = $_POST['cc'];
$subject = $_POST['subject'];
$mesg = $_POST['mesg'];
$start = $_POST['start'];
$end = $_POST['end'];
$mid1 = $_POST['mid1'];
$mid2 = $_POST['mid2'];
$message = $start.$mid1.$mesg.$mid2.$end;
$config = array(
'useragent' => 'CodeIgniter',
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => '***',
'smtp_pass' => '**',
'mailtype' => 'html',
'charset' => 'utf-8',
'newline' => '\r\n'
);
$this->load->library('email',$config);
$this->email->set_newline('\r\n');
$this->email->from($address,$from);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($message);
$this->email->cc($cc);
$path = $this->config->item('server_root');
$file = $path.'/mshaadi/';
$this->load->library('upload');
$m = count($_FILES['atta']['name']);
$files = $_FILES;
for($i=0; $i< $m; $i++){
$_FILES['atta']['name']= $files['atta']['name'][$i];
$_FILES['atta']['type']= $files['atta']['type'][$i];
$_FILES['atta']['tmp_name']= $files['atta']['tmp_name'][$i];
$_FILES['atta']['error']= $files['atta']['error'][$i];
$_FILES['atta']['size']= $files['atta']['size'][$i];
$this->upload->initialize($this->set_upload_options());
$this->upload->do_upload('atta');
$a = $files['atta']['name'][$i];
$mm = base_url().'images/'.$a;
$this->email->attach($mm);
}
if($this->email->send()){
redirect('Email');
}else{
show_error($this->email->print_debugger());
}
}
private function set_upload_options(){
$config = array();
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png|pdf|sql|docx|pptx';
$config['max_size'] = '10000';
$config['overwrite'] = TRUE;
return $config;
}
Error while sending multiple attachment of docx, pptx
220-gator3150.hostgator.com ESMTP Exim 4.85 #2 Thu, 19 Nov 2015 00:10:43 -0600 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
220-gator3150.hostgator.com ESMTP Exim 4.85 #2 Thu, 19 Nov 2015 00:10:43 -0600 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
hello: 250-gator3150.hostgator.com Hello 127.0.0.1 [112.196.141.163]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250 HELP
from: 250 OK
to: 501 <>: missing or malformed local part
The following SMTP error was encountered: 501 <>: missing or malformed local part
data: 503-All RCPT commands were rejected with this error:
503-501 <>: missing or malformed local part
503 Valid RCPT command must precede DATA
The following SMTP error was encountered: 503-All RCPT commands were rejected with this error: 503-501 <>: missing or malformed local part 503 Valid RCPT command must precede DATA
500 unrecognized command
The following SMTP error was encountered: 500 unrecognized command
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Thu, 19 Nov 2015 07:10:37 +0100
From: "" <>
Return-Path: <>
Subject: =?ISO-8859-1?Q??=
Reply-To: "" <>
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <564d67dddeddc>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_564d67dddeddc"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_564d67dddeddc
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
--B_ALT_564d67dddeddc
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
--B_ALT_564d67dddeddc--
$this->load->library('email');
$this->load->helper('path');
$this->load->helper('directory');
//setting path to attach files
$path = set_realpath('assets/your_folder/');
$file_names = directory_map($path);
$this->email->clear(TRUE);
$this->email->to($address);
$this->email->from('your#example.com');
$this->email->subject('Here is your info '.$name);
$this->email->message('Hi Here is the info you requested.');
foreach($file_names as $file_name)
{
$this->email->attach($file_name);
}
$this->email->send();
For multiple attachments you can use the same function multiple times,On your code you haven't used multiple times and not given loop too.
Try using the full path instead of just the url-
$this->email->attach('C:\Users\xyz\Desktop\images\abc.png');
or
$attched_file= $_SERVER["DOCUMENT_ROOT"]."/uploads/".$file_name;
$this->email->attach($attched_file);
also try changing the charset as-
$config['charset'] = 'iso-8859-1';
Codeigniter send email with attach file
https://ellislab.com/codeigniter/user-guide/libraries/email.html

codeigniter cookie expiry problem

I'm having a cookie issue, the expiry date on my cookie is always being set to At End Of Session which isn't what I want. I did a bit of goggling and it suggested it set the expire to time()+60*60*24*30 which I've done.
//Create basket cookie
$cookie = array(
'name' => 'basket_id',
'value' => $basket_id,
'expire' => time()+60*60*24*30,
'domain' => 'domain',
'path' => '/',
'prefix' => '',
);
set_cookie($cookie);
I did wonder if it could be down to a Codeignter setting but my ci_session cookie has a normal expiry date. Thu, 09 Jun 2011 10:39:02 GMT
This is what I get when I view the cookie:
Name basket_id
Value 28
Host .host
Path /
Secure No
Expires At End Of Session
And here is an example of the array I'm passing to the cookie.
Array ( [name] => basket_id [value] => 30 [expire] => 1310202067 [domain] => host [path] => / [prefix] => )
Your expiry date is set incorrectly. You don't have to include the time(), as what you're setting is actually the expiry date from time().
When you have an incorrect expire value, it defaults to 0, which is set as your session's length instead.
Therefore it should be:
$cookie = array(
'name' => 'basket_id',
'value' => $basket_id,
'expire' => 86400*30,
'domain' => 'domain',
'path' => '/',
'prefix' => '',
);
Please check out the answer below by #Gowri for how to do it properly.
You can try to adjust session expiration time in config.php CI session initially is saved in cookies:
/** Session Variables
---------------------------------------
| 'session_expiration' = the number of SECONDS you want the session to last.
| by default sessions last 7200 seconds (two hours). Set to zero for no expiration.
|
*/
$config['sess_expiration'] = 7200;
You can add params
$config['cookie_lifetime'] = 1800
in config.php, the reason you can find in libraries/Sessions/Session.php, code below
$expiration = config_item('sess_expiration');
if (isset($params['cookie_lifetime']))
{
$params['cookie_lifetime'] = (int) $params['cookie_lifetime'];
}
else
{
$params['cookie_lifetime'] = (!isset($expiration) && config_item('sess_expire_on_close'))
? 0 : (int) $expiration;
}

Resources