1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

axiosを使ってKibanaにAPIでログインする

Posted at

概要

xpack Securityを使っていると、Kibanaで提供されるDashboardのShare機能でログイン画面が表示される。
なのでAPIでログインしたあとにiframeを表示する、的なことをやりたかった

前提

コード


loginKibana: function(kibanaInfo, callback, error){
  const config = {	headers: {'Content-Type': 'application/json','Cache-Control' : 'no-cache', 'kbn-xsrf' : 'kibana'}};

  const data = {
    username: kibanaInfo.username,
    password: kibanaInfo.password
  }

  axios.post(`${kibanaInfo.host}/api/security/v1/login`, data, config).then(callback).catch(error);
}

callbackでiframeの表示処理を書いてあげるとログイン済みになる

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?