javascript - set client-secret in keyclok-Angular - Stack Overflow

I am not able to set client-secret in config object of keyClockfunction initializeKeycloak(keycloak: K

I am not able to set client-secret in config object of keyClock

function initializeKeycloak(keycloak: KeycloakService) {
  return () =>
    keycloak.init({
      config: {
        url: 'http://localhost:8080/auth',
        realm: 'your-realm',
        clientId: 'your-client-id',
        client-secret: 'xxxxxxxxxxx'    <-- problem
      },
      initOptions: {
        onLoad: 'check-sso',
        silentCheckSsoRedirectUri:
          window.location.origin + '/assets/silent-check-sso.html',
      },
    });
}

where we can set clicnt-secret? please help me with it Thank you

I am not able to set client-secret in config object of keyClock

function initializeKeycloak(keycloak: KeycloakService) {
  return () =>
    keycloak.init({
      config: {
        url: 'http://localhost:8080/auth',
        realm: 'your-realm',
        clientId: 'your-client-id',
        client-secret: 'xxxxxxxxxxx'    <-- problem
      },
      initOptions: {
        onLoad: 'check-sso',
        silentCheckSsoRedirectUri:
          window.location.origin + '/assets/silent-check-sso.html',
      },
    });
}

where we can set clicnt-secret? please help me with it Thank you

Share Improve this question asked Mar 16, 2021 at 13:52 shubham sonishubham soni 411 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

A client application is considered public when an end user could possibly view and modify the code. This includes Single-Page Apps (SPAs) or any mobile or native applications. In both cases, the application can't keep secrets from malicious users. So your Angular code is public and it can't keep any secret. Don't save any secrets there, but use public OIDC client and Authorization Code Flow with PKCE, which is designated for that.

Please read doc of used library to have more details. Just idea (not a full working copy&paste code!):

function initializeKeycloak(keycloak: KeycloakService) {
  return () =>
    keycloak.init({
      config: {
        url: 'http://localhost:8080/auth',
        realm: 'your-realm',
        clientId: 'your-client-id'
      },
      initOptions: {
        checkLoginIframe: false, 
        pkceMethod: 'S256'
        onLoad: 'login-required'
      },
    });
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744797851a4594311.html

相关推荐

  • javascript - set client-secret in keyclok-Angular - Stack Overflow

    I am not able to set client-secret in config object of keyClockfunction initializeKeycloak(keycloak: K

    2天前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信