-
Notifications
You must be signed in to change notification settings - Fork 134
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] Reset Password is not working #363
Comments
Hi @stm-dschulz! This is a known issue/gap that the SLAS password reset flow currently doesn't work in the PWA. My understanding is that the SLAS password reset endpoint ( I believe SLAS team is actively working on this issue. For now, if you need to implement this feature, you need to create a server side endpoint that grabs AM OAuth token, call the endpoint and create a password reset token, then you use that token to reset password using another endpoint |
To offer an alternative, you can also bridge the current API gap using OCAPI hooks. https://github.com/SalesforceCommerceCloud/ocapi_hooks_collection shows how to do this.
You can review the tests for the basic flow: I'm going to leave this issue open until we've resolved it in the default generated PWA. |
Hi @kevinxh , @johnboxall , We will use the OCAPI solution to fix this. Whats your opinion - makes sense to contribute this fix? |
Hey @stm-dschulz, I don't believe a fix can be contributed in the scope of this repo right now. Going forward, one of three things will happen:
Until one of these three things happen, I believe this issue is blocked. If yah'll do end up going the OCAPI route, I'd appreciate if you upstreamed any changes to https://github.com/SalesforceCommerceCloud/ocapi_hooks_collection, as if we choose to formally adopt a hooks cartridge for PWA Kit, this will most likely be our starting point. |
Hello @stm-dschulz Thank you for the feedback. We will be looking into this in the first half of 2023. |
Quick note, the OCAPI Shop To call it, you'll need to use regular OCAPI Auth: A trick I commonly use is to create a "super" API Client that can be used both for SLAS and OCAPI calls. To do this:
Thanks! |
A following question is : what OCPI api is to be used to actually reset the password after obtaining the reset token using the afterPOST hook described above ? |
Once "Environment Variables" ships in Managed Runtime ~2023 June, our recommended approach will likely to be to use the SLAS Password Reset API with a callback URI to MRT: https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-password-reset.html Then MRT can send the email using a configured email service provider. Alternatively, you could set a B2C Commerce controller as callback URI, and use its email sending capabilities. |
Environment Variables for Managed Runtime has now shipped: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/managed-runtime-administration.html#environment-variables You can use environment variables to inject the Client ID + Secret of a SLAS Private client into your code, then create an Express.js handler to forward requests to the relevant password reset APIs and optionally send a password reset email through your ESP. https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas-password-reset.html |
To fix the Password Reset functionality in your Progressive Web App (PWA), follow these steps: Thanks |
Hello, I am working on correcting the password reset functionality and I have tried implementing the above 3 steps. I am able to get the admin access token from the Thanks! |
@lisa-mcgerr it seems like you may have not set up the access token correctly. But, as per @johnboxall's comment, you should be able to do this by following the SLAS Password Reset guide, which should not require an OCAPI access token. |
Hi , still have this problem . does someone has working example how can I fix this 401 unauthorised error during "reset-password" flow ? |
This issue has been linked to a new work item: W-15953350 |
Summary
When using "Reset Password" the app returns the error "Your access-token is invalid and could not be used to identify the API client.". This happens regardless if the email is known to the system or not.
Steps To Reproduce
Expected result
Actual result
System Information (as applicable)
Browser: Chrome Version 97.0.4692.99
Node version:
pwa-kit version: 1.3
Desktop OS:
Mobile Device Info:
Happens on the official test system, on our test system and locally.
Additional information
I tried to trace down this to myself but was not successful.
It seems that the underlying call
https://{{short_code}}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{{organization_id}}/customers/password/actions/create-reset-token?siteId={{site_id}}
is executed with the SLAS token and this does not work. I can reproduce the same error in Postman.
The documentation actually says to use the AM based token (
https://account.demandware.com/dwsso/oauth2/access_token
). But this did also not work for me and returns"Your access-token is valid, but you have no permissions to access the resource.".
The related OCAPI permission is set but there is no related AuthZ Scope that could be set.
The text was updated successfully, but these errors were encountered: