Skip to content

Commit 73af840

Browse files
authored
docs: Update README.md to correct addScope parameter type in 1.0.0 (#405)
* Update README.md Correct the calls to addScope which now requires an array, not a string * Replaced usage of array() with [] * remove redundant addScope call from documentation
1 parent 4e32595 commit 73af840

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ use Jumbojett\OpenIDConnectClient;
6969
$oidc = new OpenIDConnectClient('https://id.provider.com',
7070
'ClientIDHere',
7171
'ClientSecretHere');
72-
$oidc->providerConfigParam(array('token_endpoint'=>'https://id.provider.com/connect/token'));
73-
$oidc->addScope('my_scope');
72+
$oidc->providerConfigParam(['token_endpoint'=>'https://id.provider.com/connect/token']);
73+
$oidc->addScope(['my_scope']);
7474

7575
// this assumes success (to validate check if the access_token property is there and a valid JWT) :
7676
$clientCredentialsToken = $oidc->requestClientCredentialsToken()->access_token;
@@ -85,12 +85,12 @@ use Jumbojett\OpenIDConnectClient;
8585
$oidc = new OpenIDConnectClient('https://id.provider.com',
8686
'ClientIDHere',
8787
'ClientSecretHere');
88-
$oidc->providerConfigParam(array('token_endpoint'=>'https://id.provider.com/connect/token'));
89-
$oidc->addScope('my_scope');
88+
$oidc->providerConfigParam(['token_endpoint'=>'https://id.provider.com/connect/token']);
89+
$oidc->addScope(['my_scope']);
9090

9191
//Add username and password
92-
$oidc->addAuthParam(array('username'=>'<Username>'));
93-
$oidc->addAuthParam(array('password'=>'<Password>'));
92+
$oidc->addAuthParam(['username'=>'<Username>']);
93+
$oidc->addAuthParam(['password'=>'<Password>']);
9494

9595
//Perform the auth and return the token (to validate check if the access_token property is there and a valid JWT) :
9696
$token = $oidc->requestResourceOwnerToken(TRUE)->access_token;
@@ -105,10 +105,9 @@ use Jumbojett\OpenIDConnectClient;
105105
$oidc = new OpenIDConnectClient('https://id.provider.com',
106106
'ClientIDHere',
107107
'ClientSecretHere');
108-
$oidc->setResponseTypes(array('id_token'));
109-
$oidc->addScope(array('openid'));
108+
$oidc->setResponseTypes(['id_token']);
110109
$oidc->setAllowImplicitFlow(true);
111-
$oidc->addAuthParam(array('response_mode' => 'form_post'));
110+
$oidc->addAuthParam(['response_mode' => 'form_post']);
112111
$oidc->setCertPath('/path/to/my.cert');
113112
$oidc->authenticate();
114113
$sub = $oidc->getVerifiedClaims('sub');
@@ -184,7 +183,7 @@ function handleLogout() {
184183
session_commit();
185184
session_id($session_id_to_destroy); // switches to that session
186185
session_start();
187-
$_SESSION = array(); // effectively ends the session
186+
$_SESSION = []; // effectively ends the session
188187
}
189188
}
190189
}

0 commit comments

Comments
 (0)