Looker Embed SDK 저장소에는 샘플 코드와 Embed SDK의 간단한 데모가 포함되어 있습니다. Looker는 보안에 각별히 신경을 쓰고 있으므로 데모를 사용하려면 약간의 설정이 필요합니다. 또한 데모에는 Looker 삽입 보안 비밀이 필요합니다. 삽입 보안 비밀은 모든 데이터에 대한 액세스 권한을 부여하므로 다음 사항에 유의하세요.
인스턴스에 대한 전체 액세스 권한을 부여하고 싶지 않은 사용자와 보안 비밀을 공유하지 마세요.
// The address of your Looker instance. Required.exportconstlookerHost='self-signed.looker.com:9999'// A dashboard that the user can see. Set to 0 to disable dashboard.exportconstdashboardId=1// A Look that the user can see. Set to 0 to disable look.exportconstlookId=1
삽입하려는 사용자 유형에 적합하도록 demo/demo_user.json 파일을 수정합니다.
{// External embed user ID. IDs are not shared with regular users. Required"external_user_id":"user1",// First and last name. Optional"first_name":"Pat","last_name":"Embed",// Duration before session expires, in seconds. Required."session_length":3600,// Enforce logging in with these permissions. Recommended."force_logout_login":true,// External embed group ID. Optional."external_group_id":"group1",// Looker Group IDs. Optional"group_ids":[],// Permissions. See documentation for details. Required.// Can any combination of:// access_data// see_looks// see_user_dashboards// see_lookml_dashboards// explore// create_table_calculations// download_with_limit// download_without_limit// see_drill_overlay// see_sql// save_content// embed_browse_spaces// schedule_look_emails// send_to_sftp// send_to_s3// send_outgoing_webhook// schedule_external_look_emails"permissions":["access_data","see_looks","see_user_dashboards","explore""save_content","embed_browse_spaces"],// Model access permissions. Required."models":["powered_by","thelook"],// User attributes. Optional."user_attributes":{"locale":"en_US"},}
3단계: 데모 빌드 및 실행
노드 서버
npm install 실행
npm start 실행
서버에서 실행 중인 호스트와 포트를 출력합니다. http://localhost:8080과 다른 경우 삽입된 도메인 허용 목록에 추가해야 합니다.
Python 서버
npm install 실행
npm run python 실행
서버에서 실행 중인 호스트와 포트를 출력합니다.
Python 2/3 호환성 레이어를 설치하려면 pip install six를 수행해야 할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-05-30(UTC)"],[],[],null,["# Embed SDK Demo\n\nThe Looker [Embed SDK repository](https://github.com/looker-open-source/embed-sdk) includes sample code and a demo of the Embed SDK. Because of Looker's security requirements, the demo requires a bit of setup. The demo also requires your Looker [embed secret](/looker/docs/admin-panel-platform-embed#embed_secret). The embed secret grants access to all of your data, so note the following:\n\n- Don't share your secret with anyone whom you don't want to have complete access to your instance.\n- Don't reset your secret if you already are using it in another context.\n- Don't set up your code to store the secret in the web browser.\n\nStep 1: Enable embedding in your Looker instance\n------------------------------------------------\n\nThis is documented in more detail on the [Signed embedding](/looker/docs/single-sign-on-embedding) documentation page.\n\n1. Navigate to **Admin \\\u003e Platform Embed** on your Looker instance. This requires Admin privileges.\n2. The demo server runs by default at `http://localhost:8080`. By adding that address to the [**Embedded Domain Allowlist**](/looker/docs/admin-panel-platform-embed#embedded_domain_allowlist), you can enable the demo to receive messages from Looker.\n3. Turn on **Embed Authentication**.\n4. In order to view your embed secret you must reset it. Copy the secret to a secure place.\n\nStep 2: Customize the demo settings for your Looker instance\n------------------------------------------------------------\n\nProvide your embed secret to the server. You can do this in the following ways:\n\n- Set it as `LOOKER_EMBED_SECRET` in your shell environment.\n- Create a file named `.env` in the root of the sdk directory. Add a line to that file: `LOOKER_EMBED_SECRET=\"YourLookerSecret\"`\n\nProvide your Looker instance host address to the server by using one of the following methods:\n\n- Set it as `LOOKER_WEB_URL` in your shell environment.\n- Add `LOOKER_WEB_URL=\"yourinstance.looker.com:yourport\"` to the `.env` file.\n\n| **Note:** The existing environment variable `LOOKER_EMBED_HOST` can also be used instead of `LOOKER_WEB_URL`.\n\nEdit the ENV file to specify the IDs of the content that you want to embed. \n\n # Looker Embed Data Configuration\n # Set to - if demo needs to ignore it\n\n # Dashboard IDs\n LOOKER_DASHBOARD_ID=1\n LOOKER_DASHBOARD_ID_2=2\n # Look ID\n LOOKER_LOOK_ID=1\n # Explore ID\n LOOKER_EXPLORE_ID=model::explore\n # Extension ID\n LOOKER_EXTENSION_ID=extension::my-great-extension\n # Report ID\n LOOKER_REPORT_ID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\n # Query Visualization ID\n LOOKER_QUERY_VISUALIZATION_ID=1234567890ABCDEF123456\n\nEdit the `demo/demo_user.json` file to be appropriate for the type of user you want to embed. \n\n {\n // External embed user ID. IDs are not shared with regular users. Required\n \"external_user_id\": \"user1\",\n // First and last name. Optional\n \"first_name\": \"Pat\",\n \"last_name\": \"Embed\",\n // Duration before session expires, in seconds. Required.\n \"session_length\": 3600,\n // Enforce logging in with these permissions. Recommended.\n \"force_logout_login\": true,\n // External embed group ID. Optional.\n \"external_group_id\": \"group1\",\n // Looker Group IDs. Optional\n \"group_ids\": [],\n // Permissions. See documentation for details. Required.\n // Can any combination of:\n // access_data\n // see_looks\n // see_user_dashboards\n // see_lookml_dashboards\n // explore\n // create_table_calculations\n // download_with_limit\n // download_without_limit\n // see_drill_overlay\n // see_sql\n // save_content\n // embed_browse_spaces\n // schedule_look_emails\n // send_to_sftp\n // send_to_s3\n // send_outgoing_webhook\n // schedule_external_look_emails\n \"permissions\": [\n \"access_data\",\n \"see_looks\",\n \"see_user_dashboards\",\n \"explore\",\n \"save_content\",\n \"embed_browse_spaces\"\n ],\n // Model access permissions. Required.\n \"models\": [\"powered_by\", \"thelook\"],\n // User attributes. Optional.\n \"user_attributes\": { \"locale\": \"en_US\" },\n }\n\nStep 3: Build and run the demo\n------------------------------\n\nTo build and run the demo, follow the steps for the appropriate server.\n\n### Node server\n\n1. Run `npm install`\n2. Run `npm start`\n\nThe server will print out what host and port it is running on. If it is different than `http://localhost:8080` then you will need to add it to your [**Embedded Domain Allowlist**](/looker/docs/admin-panel-platform-embed#embedded_domain_allowlist).\n\n### Python server\n\n1. Run `npm install`\n2. Run `npm run python`\n\nThe server will print out what host and port it is running on.\n\nYou may need to `pip install six` to install the Python 2/3 compatibility layer."]]