Skip to content
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

kcFakeLogin stuck on redirecting #23

Open
MarkLyck opened this issue Sep 25, 2020 · 2 comments
Open

kcFakeLogin stuck on redirecting #23

MarkLyck opened this issue Sep 25, 2020 · 2 comments

Comments

@MarkLyck
Copy link

When trying to login with kcFakeLogin, cypress just gets infinitely stuck on page loading.

Screen Shot 2020-09-25 at 18 40 33

my users/user.json fixture:

{
  "username": "mark@*****.com",
  "password": "*****",
  "fakeLogin": {
    "access_token": "*****",
    "refreshToken": "*****",
    "id_token": "*****",
    "account": {}
  }
}

I've tripple checked the tokens and info above are correct (copied from a real login).

my test:

describe('Keycloak', () => {
  it('Keycloak loads', () => {
    cy.kcFakeLogin('user');
  });
});

initConfig:

{
        flow: 'implicit',
        onLoad: 'check-sso',
        checkLoginIframe: false,
}

(I have tried replacing this with the one from your docs, but that didn't work either).

cypress.json

{
  "baseUrl": "http://localhost:3000",
  "env": {
    "auth_base_url": "https://sso.****.com/auth",
    "auth_realm": "****",
    "auth_client_id": "react-admin",
    "auth_client_secret": "*****"
  }
}

my normal keycloak.json looks like this:

{
  "auth-server-url": "https://sso.*****.com/auth",
  "confidential-port": 0,
  "credentials": { "secret": "*****" },
  "realm": "rogers",
  "resource": "react-admin",
  "ssl-required": "external"
}

I'm not sure if there's anything special here that this npm module isn't built to handle?

Visiting localhost:3000 of course works just fine in the browser.

I've been trying to get this working for 5 hours today with no luck.

@WaldemarEnns
Copy link

Interesting... I have a similar issue:
I am using Vue with VueX and vuex-oidc (an oidc-client implementation for vue+vuex). I have a .env.local file with auth-provider A:

VUE_APP_AUTH_PROVIDER_URL="https://auth.providerA.com/auth/realms/my-realm"
VUE_APP_AUTH_CLIENT_ID="my-client"

and my cypress.json has configured provider B:

{
  ...
  "env": {
    "auth_base_url": "https://auth.providerB.com/auth",
    "auth_realm": "my-realm",
    "auth_client_id": "my-client"
  }
  ...
}

When I use kcFakeLogin("user") somehow cypress tries to open a frame to https://auth.providerA.com - which makes me wonder, since my cypress.json is using providerB ... Both are configured and work in dev mode, but cypress somehow doesn't know which one to use...

@WaldemarEnns
Copy link

Update

I figured out how to fix my chrome-error, redirects-error, CORS-error issues.
Maybe this can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants