helloagain / shopware6
HelloAgain Connector plugin Shopware 6
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
Type:shopware-platform-plugin
pkg:composer/helloagain/shopware6
Requires
- php: ^8.0
- ext-curl: *
- ext-json: *
- firebase/php-jwt: ^6.0
README
Shopware 6 Plugin for hello again
Release
./package.sh
Shopware Versions
- 6.6 is on branch
main - 6.5 is on branch
shopware-6.5 - 6.4 is on branch
shopware-6.4(deprecated)
Installation
Cron Job
bin/console helloagain:data-export
Configuration
Oauth2 Authorize URI: BASEURL/hla/oauth2/authorize
Oauth2 Exchange Token URI: BASEURL/hla/oauth2/token
Webview Init URI: BASEURL/hla/session/init?helloagain_token={{externalToken}}
Webview with Redirect: BASEURL/hla/session/init?helloagain_token={{externalToken}}&redirect_uri={{redirectUrl}}
Headless Mode
This plugin can also be used in a headless Shopware environment, by utilising the following APIs via the Headleass Frontend.
Documentation for Zebra Fashion: https://docs.google.com/document/d/17voZ_7pbhnsC-oCaRW0s6fKx5PwrdjrTg4OCVzYCjoQ/edit?tab=t.0
Authorization Code Endpoint
- The request requires an
sw-access-keyas well as answ-context-token, see: https://developer.shopware.com/docs/products/extensions/b2b-suite/guides/core/store-api.html#authentication - The
sw-context-tokencan be acquired via thestore-api/account/loginendpoint:
curl --location '<BASE_SHOP_URL>/store-api/account/login' \
--header 'sw-access-key: <SW-ACCESS-KEY>' \
--form 'username="<USERNAME>"' \
--form 'password="<PASSWORD>"'
- Afterwards an Authorizaction Code can be acquired via:
curl --location '<BASE_SHOP_URL>/store-api/v1/authorize' \
--header 'sw-access-key: <SW-ACCESS-KEY>' \
--header 'sw-context-token: <SW-CONTEXT-TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"scope": "email first_name last_name"
}'
- The headless frontend has to redirect with that access token according to the OAuth 2.0 Authorization Code Flow:
HTTP/2.0 302
Header
location: <REDIRECT_URI>?state=<STATE>&code=<AUTHORIZATION_CODE>
Token Endpoint
curl --location '>BASE_SHOP_URL>/store-api/v1/token' \
--header 'Content-Type: application/json' \
--data '{
"code": "<AUTHORIZATION_CODE>",
"client_id": "<CLIENT_ID>",
"client_secret": "<CLIENT_SECRET>",
"grant_type": "authorization_code"
}'
Get User By Token Endpoint
- Uses the following API to retrieve the user from hello again based on the passed
helloagain_tokenparameter: https://api.helloagain.at/external/docs/swagger/#/users/users_authenticate_read - Uses the following API to retrieve the users shop id via the third party authentication user: https://api.helloagain.at/external/docs/swagger/#/users/users_third-party-authentication_read
curl -X POST -d '{"helloagain_token": "<hello-again-token>"}' "<BASE_SHOP_URL>/store-api/v1/get-user-by-token" -H "Content-Type: application/json"