簡體   English   中英

在 Google Cloud Identity api 上獲取 404

[英]Getting 404 on Google Cloud Identity apis

我必須查找給定用戶是否屬於谷歌雲中的給定組。 我正在使用群組成員資格 api 查找。 這是我的代碼

package main

import (
  "context"
  "google.golang.org/api/cloudidentity/v1beta1"
)

func main() {  
  ctx := context.Background()
  cloudidentityService, err := cloudidentity.NewService(ctx)
  if err != nil {
        panic(err)
    }
    
  res, err := cloudidentityService.Groups.Memberships.Lookup("GroupName").MemberKeyId("MemberLookingForInGroup").Context(ctx).Do() 
  
  if err != nil {
        panic(err)
    }
}

我收到 404 錯誤:

    panic: googleapi: got HTTP response code 404 with body: <!DOCTYPE html>
    <html lang=en>
      <meta charset=utf-8>
      <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
      <title>Error 404 (Not Found)!!1</title>
      <style>
        *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
      </style>
      <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
      <p><b>404.</b> <ins>That’s an error.</ins>
      <p>The requested URL <code>/v1beta1/memberKey.namespace/memberships:lookup?alt=json&amp;memberKey.id=membertoloookup&amp;prettyPrint=false</code> was not found on this server.  <ins>That’s all we know.</ins>

檢查谷歌文檔,錯誤是由於沒有關聯 API 方法或請求引用了一個或多個未找到的資源。

在此處輸入圖像描述

我建議您查看 Clark McCauley 提出的建議,檢查您是否關聯了正確的 API

這里有一份官方文檔,可以幫助大家更好的排查錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM