更新时间:2024-04-18 GMT+08:00
分享

Token认证

  • Java
    import com.huawei.ges.graph.v1.GESGraphClient;
    import com.huawei.ges.graph.v1.auth.token.GesGraphTokenCredentials;
    import com.huaweicloud.sdk.core.auth.ICredential;
    import com.huaweicloud.sdk.core.http.HttpConfig;
      //此处需要输出您的图实例IP
    String graphEndpoint = "{graphEndpoint}";
    ICredential auth = new GesGraphTokenCredentials().withXAuthToken(authToken);
    HttpConfig httpConfig = new HttpConfig().withIgnoreSSLVerification(true);
    GESGraphClient client = GESGraphClient.newBuilder().withCredential(auth).withEndpoints(Arrays.asList(graphEndpoint)).withHttpConfig(httpConfig).build();
  • Python
    from gesgraphsdk.v1 import GESGraphClient
    from gesgraphsdk.v1.token_credentials import GesGraphTokenCredentials
    from huaweicloudsdkcore.http.http_config import HttpConfig
    
    graph_endpoint = "{graphEndpoint}"
    auth = GesGraphTokenCredentials(token="{token}")
    http_conf = HttpConfig(ignore_ssl_verification=True, timeout=60)
    client = GESGraphClient.new_builder().with_credentials(auth).with_endpoint(graph_endpoint).with_http_config(http_conf).build()
分享:

    相关文档

    相关产品