Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
saveAppSecret example
if
(
!
$manifest
->
getSetup
(
)
)
{
return
;
}
try
{
$appName
=
$manifest
->
getMetadata
(
)
->
getName
(
)
;
$appResponse
=
$this
->
registerWithApp
(
$manifest
,
$context
)
;
$secret
=
$appResponse
[
'secret'
]
;
$confirmationUrl
=
$appResponse
[
'confirmation_url'
]
;
$this
->
saveAppSecret
(
$id
,
$context
,
$secret
)
;
$this
->
confirmRegistration
(
$id
,
$context
,
$secret
,
$secretAccessKey
,
$confirmationUrl
)
;
}
catch
(
RequestException
$e
)
{
if
(
$e
->
hasResponse
(
)
&&
$e
->
getResponse
(
)
!== null
)
{
$response
=
$e
->
getResponse
(
)
;
$data
=
json_decode
(
$response
->
getBody
(
)
->
getContents
(
)
, true
)
;
if
(
isset
(
$data
[
'error'
]
)
&& \
is_string
(
$data
[
'error'
]
)
)
{
throw
AppException::
registrationFailed
(
$appName
,
$data
[
'error'
]
)
;
}
}