Spartacus Backend OCC login endpoint change

562 views Asked by At

I have a question regarding the possibility to change the backend occ endpoint for the login.

enter image description here

In the default behavior, an auth object is created in local storage.

I changed in the app.module the default login: '/authorizationserver/oauth/token', to a different endpoint (/ourowntestserver/oath/token/test). After the change, the backend-side works as it has before, but on the front-end side, the auth object is not available in the local storage anymore.

In the Spartacus source code I can see an OAUTH_ENDPOINT with the same endpoint '/authorizationserver/oauth/token', used in an open-id-token.service, but I am not sure if that service is responsible for actually saving the token and if I have to extend it in the storefront app along with its store(actions, effects, etc.) too.

Are there any other changes that have to be done for this to work, or am I doing something wrong? Is it possible that the issue could be still back-end related?

Any help would be appreciated. (edited)

1

There are 1 answers

0
Marcin Lasak On

I would start by inspecting ngrx actions in devtools. Look for LoadUserToken and LoadUserTokenSuccess and LoadUserTokenFail actions. Look at their payload if everything there looks ok. Maybe the structure of response is different than the one returned from the default hybris OAuth server. Then you might need to create your own effect and handle the response a bit different than we do this by default.

The OAUTH_ENDPOINT is not currently customizable and it is being fixed right now for the 3.0 release. It'll have new auth module structure and allow for easier replacement of OAuth server.

open-id-token.service.ts is only used with Kyma module when you also need apart from access_token the id_token from OAuth server.