-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Not getting correct secret key in callback controller trigerred by SLAS #1878
Comments
Hi @TayyabSalmanMRM1996, good questions! As you've noticed, the purpose of To limit when the client secret is injected so only the SLAS requests that need it get it, this endpoint by default is configured to only inject the actual client secret on requests sent to SLAS As you are attempting to introduce new SLAS endpoints where the client secret injection will apply (under the hood, slasClient.getPasswordLessAccessToken will send a request to the SLAS The For example, to add ssr.js
|
@vcua-mobify that code doesn't execute when I trigger the password-less login API.
I have following in ssr.js:
|
Even after manually setting the proxy like But in the callback controller, there is no such secret that we can use to secure that callback controller. |
Hi @vcua-mobify - just taking a follow-up if there is any update on this and if we can do something from our side to get the correct secret in the request of the callback controller. Thanks! |
Hi @TayyabSalmanMRM1996, I am not the most familiar with the intricacies of the passwordless login flow. But if I am understanding your question correctly, you are asking how could your app make the request to exchange the Or did you mean handling the secret when the callback controller receives the request from SLAS If it is the former (your callback controller is sending a request to SLAS), assuming your controller also has access to the API, I think you could try sending a call via |
@vcua-mobify the call is sent through proxy. Since, we are triggering email in the callback controller, the issue is, anyone can use that callback controller How can we make sure that requests are coming from SLAS? Or is there a way to validate that the authentication code received in this callback is a valid one? The request received in the callback controller that was triggered by SLAS should have the actual secret key for validation: https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login.html. |
While doing password-less login, as per the docs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-passwordless-login.html#prerequisites, we should send un-guessable secret in params. We're doing this:
await slasClient.authorizePasswordlessCustomer({ body: { userId: email, channel_id: site?.id, mode: 'callback', callback_uri: ${hostUrl}/s/US/passwordlesslogin/callback?secret=${SLAS_SECRET_PLACEHOLDER}, user_id: email, usid: cookie.get('usid') } })
We expect SLAS to decode
SLAS_SECRET_PLACEHOLDER
and change it to our correct secret key so that we can make it secure in the callback controller. But we don't see the correct secret key in the callback controller. We see_PLACEHOLDER_PROXY-PWA_KIT_SLAS_CLIENT_SECRET
. Shouldn't it give the correct secret key? Else, we'll not be able to secure the callback controller.We can't send the correct secret key in
callback_uri
because we don't want to expose it.The text was updated successfully, but these errors were encountered: