Closed riyazuddinsyed closed 3 years ago
Name request app needs similar piece of code in main.ts to auto-authenticate the user if a session exists.
they need similar piece of code on their main.ts file on app init.
async function syncSession () {
await KeyCloakService.setKeycloakConfigUrl(`${process.env.VUE_APP_PATH}config/kc/keycloak.json`)
// Do not do auto authenticate the user if user is trying a login or logout
if (!CommonUtils.isSigningIn() && !CommonUtils.isSigningOut()) {
// Initialize token service which will do a check-sso to initiate session
await KeyCloakService.initializeToken(null).then(() => {}).catch(err => {
if (err?.message !== 'NOT_AUTHENTICATED') {
throw err
}
})
}
}
This bug is causing this ops ticket. WHen this bug is fixes, please comment in this ops ticket and tag me, so i can let the client know we have fixed it.
https://app.zenhub.com/workspaces/entity-5bf2f2164b5806bc2bf60531/issues/bcgov/entity/7310
~Note: payment testing is blocked by # 7332~ Update: BCOL payment is fine with BCREG0001.
~Note: this fixed is deployed to Dev but cannot be deployed to Test/Prod until Kial/Thor are finished there and have back-ported/merged their code to the namerequest main branch.~ Update: header changes are now in main branch. See other comments for deployment status.
Note: the implemented fix (as per Sumesh's code above) does not completely solve this problem. Specifically, although the account login is maintained, it reverts to the first user in NR UI... However the user can see this and change it if desired.
To maintain both the account login and user will require some extra work (not sure what exactly)... One work-around is to open NR UI in the same page when the user clicks "Request a Name". (Currently NR UI opens in a new tab and thus loses some of the login data.)
I have updated the description and implemented the second part of this ticket (ie, open NameRequest in same tab from BCROS pages).
This is deployed to Dev and I have tested it there: if I am logged in to auth-web with an account with multiple users (and I am using, say, the second user), then when I am redirected to NameRequest, the account and user are retained.
@sumesh-aot @jyoti3286 What is Relationships team's plan to deploy the latest sbc-auth changes to Test and Prod?
@lmcclung @Kaineatthelab FYI!
I just heard that auth-web (sbc-auth) will release to Prod in 2 days. Meanwhile, NR will have a release today maybe. These 2 changes don't depend on each other but both are required to resolve THIS ticket.
@forgeuxGH5 @tlebedovich Can you please confirm that the implemented fixes are OK? See comments above and/or verify in Dev.
@lmcclung @Kaineatthelab @jyoti3286 Can you please confirm your approvals to deploy these changes to sbc-auth and NR UI ASAP? Thanks!
I don't have enough knowledge of this to review. Hopefully @forgeuxGH5 does.
Looking at this now
@forgeuxGH5 FYI...
Change 1: updated NR UI to sync to existing Keycloak token (ie retain general login data)
Change 2: updated BCROS to open NR in same tab (so session storage is retained -- esp the account user)
@jyoti3286 @saravanpa-aot Can the auth-web changes made by this ticket (in this PR) be deployed through to Test/Prod today? This is very low risk but will allow NR UI to use the full KC/login data, as required by this ticket. Thanks!
@severinbeauvais I can do that. Did we get approval from @forgeuxGH5 or do we have to wait for it? Will be hard to revert it back if we don't have approval. @jyoti3286
I'm still looking at the scenarios - there are bugs in the account switching. I also can't get payment to go through with PAD - I get an error, but it's not my account so I'm not sure how the account is set-up (if it actually works). I'm just finishing up my review and I'll post here ASAP.
@saravanpa-aot do you have 10 min to discuss the bugginess? maybe 950?
I'm still looking at the scenarios - there are bugs in the account switching. I also can't get payment to go through with PAD - I get an error, but it's not my account so I'm not sure how the account is set-up (if it actually works). I'm just finishing up my review and I'll post here ASAP.
Yes, PAD payment is known error (see #7332).
Try bcreg0001 with user "BC ONLINE TECHNICAL TEAM DEVL".
Here's where I'm at: Payment on Premimum account with PAD didn't go to credit card but did not go through on PAD - encountered error. Will retry with different account. Logging in from Name Request remains on Name Request page after log in - Yes Logging in from Name Request retains information entered prior to log in - No - clears data Switching account from Name Request remains on Name Request view - No - returns to Registries Home Switching account from Name Request retains information entered prior to switching account - No - goes to last state of account (Account info page)
Will be hard to revert it back if we don't have approval.
Yes, but this change (in auth-web) has low impact either way: either NR UI opens in a new tab, or in the same tab. So does it matter? (Should make approval easier?)
Thanks @severinbeauvais . This is good to go from our side. @saravanpa-aot is deploying the changes to test and we are planning to do a release on Thursday so this will be part of that. @Milan-Freshworks is doing the regression, perhaps @riyazuddinsyed should also do it from his end. @Kaineatthelab @lmcclung - FYI
@riyazuddinsyed I think you said this was already in prod. does it still need QA?
Bug in NameRequest UI:
Case 1: When a user Logs in with a BCSC user who has a Premium Account or PAD account. Then if he navigates through the Name Request app after logged in. Then the NameRequest app doesn't have a valid login with the same User thereby compelling the users to pay through a CC card.
Case 2: When a user logs in to the name request URL which is "https://test.bcregistry.ca/namerequest/" then after a successful Login with a BCSC user who has more than one account then the user doesn't know from which account is the payment happening And there is no way for the user to navigate between the accounts Or selecting the Premium account.
Change to SBC-Auth
Open NameRequest in the current tab (instead of a new tab). This way, the account and user data are retained. (Ie, session storage is not copied over when a new tab is created.)