Spryker API's

yogik
yogik Spryker Solution Partner Posts: 2 🧑🏻‍🚀 - Cadet

Do I need premium version for using Glue API for a local project which requires api and auth,if not where to get the api documentation

Answers

  • yogik
    yogik Spryker Solution Partner Posts: 2 🧑🏻‍🚀 - Cadet

    yeah I got the swagger ui api documentation for my server but Iam not able to create access token iam getting this error {    "errors": [        {            "detail": "Invalid type.",            "status": 400        }    ]}
    do i need to download any api application or it should work with my demo shop ?

  • filip.gojkovic955
    filip.gojkovic955 Spryker Solution Partner Posts: 19 ✨ - Novice
    edited December 2023


    Verification of customer:
    For almost every GLUE API call you need access token. To get one you need VERIFIED CUSTOMER. Verified customer is customer who's registered and accepted verification email he recieved. You can set any customer to be verified mannually in database.
    In table spy_customer select customer you would like to verifiy. Go to columns "registered" and "registration_key". UNVERIFIED customers will have field "registered" set to null and some hash value in field "registration_key".
    VERIFIED user will have field "registered" set to date of registration(format yyyy-mm-dd) and "registration_key" field is set to null.


    Authentification with Oauth:
    In "yellow" file /{name-of-spryker-project}/docker/deployment/default/env/Glue.env (i don't knwo from where it is generated) there is key "SPRYKER_OAUTH_CLIENT_SECRET" and "SPRYKER_OAUTH_CLIENT_IDENTIFIER".
    That value of "SPRYKER_OAUTH_CLIENT_SECRET" needs to be hashed and placed in spy_oauth_client table in column "secret" in row where identifier is sam as "SPRYKER_OAUTH_CLIENT_IDENTIFIER". Most likely identifier will be "frontend". I'm not sure but maybe you will need to run command:
    console setup:init-db
    But i'm not 100% sure about that command.
    Hash the key using password_hash() function in php with “2y“ algorithm.

    After that you should be able to get access token.