What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey, i have a short question regarding the glue api. Do i really need the spryker/company module to

UKHESMRD2
UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

Hey, i have a short question regarding the glue api. Do i really need the spryker/company module to get access to the rest api or is there another way to authenticate a user?

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    I'm not a developer and don't know about dependencies between authentication and spryker/company, but from my experience it's absolutely possible to authenticate a user against spryker-shop/b2c-demo-shop that doesn't have spryker/company module installed.

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Du you have a workflow for that? How would you do that?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited July 2020

    Maybe I got it wrong and you are really talking about user and Zed and not about customer and Yves like I thought at first?

  • UQ958DA4U
    UQ958DA4U Posts: 232 πŸ§‘πŸ»β€πŸš€ - Cadet

    You absolutely do not need the company module. You can just authenticate to Glue with any customer.

    @UPWG9AYH2 might have some more insights.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
    edited July 2020

    In case it's a customer in Yves, you need just to send POST to {{url}}/access-tokens with a body like

    {
        "data": {
            "type":"access-tokens",
            "attributes":{
                "username":"<mailto:valerii.trots@spryker.com|valerii.trots@spryker.com>",
                "password": "change123"
            }
        }
    }
    
  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    And then for all other requests you need to use authentication with provided token.

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok, thank you guys. That's what i tried already. Currently i'm getting a "Failed to authenticate user" Error Message. The $restRequest->getRestUser() is null. Do i need a specific plugin?

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok, i think i found the issue. I get two OauthRequestTransfer Object. One without an empty clientId and one with frontend as clientId

  • UKHESMRD2
    UKHESMRD2 Posts: 37 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ok ok, i missed the setup:init-db command πŸ˜† Now it's working.