File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,35 @@ authorization" request. Another example is the client credentials flow,
2626where an access token is stored in the authorizations table which is
2727needed for executing authorized requests to the respective service.
2828
29+ Authorizations also may contain developer-provided metadata. For
30+ example, you may attach an account identifier to an authorization when
31+ an authorization process starts and use that information when
32+ authorization finishes to make sure that the authorization is only used
33+ for a specific account (or customer number, or participant id).
34+
35+ To set metadata, you need to know the authorization id when starting the
36+ authorization code flow. This code could be used in an overloaded
37+ ` startAuthorizationAction() ` :
38+
39+ ``` php
40+ $authorizationId = $oAuthClient->generateAuthorizationIdForAuthorizationCodeGrant($this->appId);
41+ $loginUri = $oAuthClient->startAuthorizationWithId(
42+ $authorizationId,
43+ $this->appId,
44+ $this->appSecret,
45+ $returnToUri,
46+ $scope
47+ );
48+ $oAuthClient->setAuthorizationMetadata($authorizationId, json_encode($metadata));
49+ ```
50+ And later, in ` finishAuthorization() ` , you may retrieve the metadata as
51+ follows:
52+
53+ ``` php
54+ $authorization = $this->getAuthorization($authorizationId);
55+ $metadata = json_decode($authorization->getMetadata());
56+ ```
57+
2958## Encryption
3059
3160By default, access tokens are serialized and stored unencrypted in the
You can’t perform that action at this time.
0 commit comments