static hasUserGitHubAccountConnected() {
    return new Promise((resolve, reject) => fetch(GitHub.GITHUB_ACCESS_TOKEN_URL, {
      method: "GET",
      headers: {
        "Authorization": "Bearer " + Auth.getAccessToken()
      }
    }).then(response => {
      if(response.status == 200) {
        return response.text();
      } else {
        resolve([false]);
      }
    }).then(text => {
      const gitHubAccessToken = text.split("access_token=")[1].split("&")[0];
      return fetch(GitHub.GITHUB_API_USER_URL, {
        method: "GET",
        headers: {
          "Accept": "application/vnd.github.v3+json",
          "Authorization": "Bearer " + gitHubAccessToken
        }
      })
    }).then(response => {
      if(response.status == 200) {
        return response.json();
      } else {
        resolve([false])
      }
    }).then(json => {
      resolve([true, json.login]);
    }));
  }
/**
   * Tries to get a GitHub access token for the user from keycloak.
   * If that works, the user has connected a GitHub account.
   * @returns {Promise<unknown>}
   */
Tries to get a GitHub access token for the user from keycloak.
If that works, the user has connected a GitHub account.
@returns {Promise}
Tries to get a GitHub access token for the user from keycloak . If that works the user has connected a GitHub account . @returns { Promise }
static hasUserGitHubAccountConnected() {
    return new Promise((resolve, reject) => fetch(GitHub.GITHUB_ACCESS_TOKEN_URL, {
      method: "GET",
      headers: {
        "Authorization": "Bearer " + Auth.getAccessToken()
      }
    }).then(response => {
      if(response.status == 200) {
        return response.text();
      } else {
        resolve([false]);
      }
    }).then(text => {
      const gitHubAccessToken = text.split("access_token=")[1].split("&")[0];
      return fetch(GitHub.GITHUB_API_USER_URL, {
        method: "GET",
        headers: {
          "Accept": "application/vnd.github.v3+json",
          "Authorization": "Bearer " + gitHubAccessToken
        }
      })
    }).then(response => {
      if(response.status == 200) {
        return response.json();
      } else {
        resolve([false])
      }
    }).then(json => {
      resolve([true, json.login]);
    }));
  }
static hasUserGitHubAccountConnected ( ) { return new Promise ( ( resolve , reject ) => fetch ( GitHub . GITHUB_ACCESS_TOKEN_URL , { method : "GET" , headers : { "Authorization" : "Bearer " + Auth . getAccessToken ( ) } } ) . then ( response => { if ( response . status == 200 ) { return response . text ( ) ; } else { resolve ( [ false ] ) ; } } ) . then ( text => { const gitHubAccessToken = text . split ( "access_token=" ) [ 1 ] . split ( "&" ) [ 0 ] ; return fetch ( GitHub . GITHUB_API_USER_URL , { method : "GET" , headers : { "Accept" : "application/vnd.github.v3+json" , "Authorization" : "Bearer " + gitHubAccessToken } } ) } ) . then ( response => { if ( response . status == 200 ) { return response . json ( ) ; } else { resolve ( [ false ] ) } } ) . then ( json => { resolve ( [ true , json . login ] ) ; } ) ) ; }
Tries to get a GitHub access token for the user from keycloak.
Tries to get a GitHub access token for the user from keycloak .