@@ -14,13 +14,16 @@ Before the session_start() use the command:
1414``` php
1515<?php
1616$sessionConfig = (new \ByJG\Session\SessionConfig('your.domain.com'))
17- ->withSecret('your super secret key');
17+ ->withSecret('your super base64url encoded secret key');
1818
1919$handler = new \ByJG\Session\JwtSession($sessionConfig);
2020session_set_save_handler($handler, true);
2121```
2222
2323Now, all your ` $_SESSION ` variable will be saved directly to a JWT Token!!
24+
25+ ## Secret key
26+ Make sure that you are providing a base64url encoded key.
2427
2528# Motivation
2629
@@ -55,7 +58,7 @@ composer require "byjg/jwt-session=2.0.*"
5558``` php
5659<?php
5760$sessionConfig = (new \ByJG\Session\SessionConfig('your.domain.com'))
58- ->withSecret('your super secret key')
61+ ->withSecret('your super base64url encoded secret key')
5962 ->withTimeoutMinutes(60); // You can use withTimeoutHours(1)
6063
6164$handler = new \ByJG\Session\JwtSession($sessionConfig);
@@ -67,7 +70,7 @@ session_set_save_handler($handler, true);
6770``` php
6871<?php
6972$sessionConfig = (new \ByJG\Session\SessionConfig('your.domain.com'))
70- ->withSecret('your super secret key')
73+ ->withSecret('your super base64url encoded secret key')
7174 ->withSessionContext('MYCONTEXT');
7275
7376$handler = new \ByJG\Session\JwtSession($sessionConfig);
@@ -79,7 +82,7 @@ session_set_save_handler($handler, true);
7982``` php
8083<?php
8184$sessionConfig = (new \ByJG\Session\SessionConfig('your.domain.com'))
82- ->withSecret('your super secret key')
85+ ->withSecret('your super base64url encoded secret key')
8386 ->replaceSessionHandler();
8487
8588$handler = new \ByJG\Session\JwtSession($sessionConfig);
@@ -90,7 +93,7 @@ $handler = new \ByJG\Session\JwtSession($sessionConfig);
9093``` php
9194<?php
9295$sessionConfig = (new \ByJG\Session\SessionConfig('your.domain.com'))
93- ->withSecret('your super secret key')
96+ ->withSecret('your super base64url encoded secret key')
9497 ->withCookie('.mydomain.com', '/')
9598 ->replaceSessionHandler();
9699
0 commit comments