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 some trouble getting the authentication token für the glue rest api. I have createt a age
Hey I have some trouble getting the authentication token für the glue rest api.
I have createt a agent user with admin rights, and I can login with this user via the backend (zed).
Then i try the following:
POST Request against glue api endpoint /agent-access-tokens
Request Body is{
"data": {
"type": "agent-access-tokens",
"attributes": {
"username": "_{{admin_username}}_",
"password": "_{{admin_password}}_"
}
}
}
As resonse I get 401{"errors":[{"code":"4101","status":401,"detail":"Failed to authenticate an agent."}]}
After some searching in the code, I found out that the error core 4101 means “invalid credentials”.
Is there any way to get deeper in the analysis, why this happens?
Comments
-
Hello Hermann.
The error can mean that the glue oauth client and secret are out of sync between your env in docker and DB.
to proof that this is the case, check if you can get the usual customer’s access token with
/access-tokens
. if you get the similar error, it would mean that resetting docker will help.0 -
this can happen when you docker/sdk boot without the full install.
unfortunately this causes the oauth client and secret to get regenerated in the docker environment.
And since this pair of value is being setup into DB in the Installer plugin, the DB will have the older value and your client validation will fail0 -
if you are debugging the core code, the error will happen here
\Spryker\Zed\Oauth\Business\Model\League\Repositories\ClientRepository::validateClient()
0 -
ok, with the customers access token I have the same issue
0 -
but the code is “003”
0 -
Hi @UQKSAARKN thank you very much for the hint, this was the issue.
For anyone, this is how i tested it and solved it:
Getting the value ofSPRYKER_OAUTH_CLIENT_SECRET
from docker/deployment/default/env/glue_eu.env (or how the corresponding env file is named in your environment.
Then getting the hash from the tablespy_oauth_client
from the columnsecret
.
Comparing each other with php functionpassword_verify('secret', 'hash')
.
In my case it was false, so I could be sure that this was the issue.
Next I took the secret from the env file and created a hash
with php functionpassword_hash('secret', PASSWORD_BCRYPT)
and saved this value to the secret column in the spy_oauth_client table.
This will resolve the mentioned issue, but to be sure that no other things are not in sync, I would also recommend to do the docker reset as @UQKSAARKN mentioned.0 -
@U01DWAYA6BC & @UQKSAARKN... wow.... thank you so much for this solution. This fixed my auth errors perfectly. 👍👍
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 927 Developer Corner
- 785 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random