简体   繁体   English

来自服务帐户 OIDC 令牌的 IAP:401 Unauthorized

[英]IAP from Service account OIDC Token : 401 Unauthorized

Hello , in a sh script i try to call an api in App Engine Standard (with a POST) behind an IAP.您好,在 sh 脚本中,我尝试在 IAP 后面的 App Engine Standard(带有 POST)中调用 api。 I use a service account who have the "IAP-secured Web App user" permission.我使用具有“IAP-secured Web App 用户”权限的服务帐户。 The service account is from an another account that the IAP.服务帐户来自 IAP 的另一个帐户。

I first generate an OpenId connect:我首先生成一个 OpenId 连接:

OIDC_token_response=$(curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer "$(gcloud auth print-access-token) \
        -H "Accept: application/json" \
        --data '{"audience":"{CLIENT_ID_IAP","includeEmail":true}' \
        -s --write-out "HTTP_CODE:%{http_code}" \
https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/${MY_SERVICE_ACCOUNT:generateIdToken)

Then i use the token:然后我使用令牌:

api_response=$(curl -X POST -H "Authorization: Bearer "${OIDC_token} -s --write-out "HTTP_CODE:%{http_code}" https://{MY-APP}.appspot.com/my-api/)

The answer is:答案是:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>401 Unauthorized</title>
<h1>Unauthorized</h1>
<p>Unauthorized</p>
HTTP_CODE:401

Any idea?任何想法?

Regards问候

The error was not at the IAP Level: the 401 error was returned by the app engine application.错误不在 IAP 级别:应用引擎应用程序返回 401 错误。 The IAP connection is OK. IAP 连接正常。 Sorry for this post.对不起这篇文章。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google IAP 不断响应 401 Unauthorized - Google IAP keeps responding with 401 Unauthorized 尝试通过服务帐户进行身份验证时收到“ 401未经授权” - getting “401 Unauthorized” while trying to authenticated with service account 对受 IAP 保护的应用程序的服务帐户请求导致“无效的 GCIP ID 令牌:JWT 签名无效” - Service account request to IAP-protected app results in 'Invalid GCIP ID token: JWT signature is invalid' 无法使用 Python 中的服务帐户密钥文件发布请求,获取“无效的 IAP 凭据:无法解析 JWT”、“401 状态代码” - Cannot POST request using service account key file in Python, getting 'Invalid IAP credentials: Unable to parse JWT', '401 Status Code' 验证GitKit令牌时出现401未经授权的错误 - 401 Unauthorized Error On Verify GitKit Token 从服务帐户进行身份验证时访问 IAP 资源时出错 - 502 服务器错误 - Error accessing a IAP resources when authenticating from a service account - 502 server error 从服务帐户进行身份验证。 Google App Engine 中的程序化 IAP 身份验证失败 - Authenticating from a service account. Programmatic IAP authentication fails in Google App Engine 在Google服务帐户中将访问令牌获取为Null - Getting access token as Null in Google service account 使用Eclipse插件在AppEngine部署期间错误401未授权(无效的OAuth令牌) - Error 401 Unauthorized (Invalid OAuth Token) during AppEngine Deployment with Eclipse Plugin 具有服务帐户的Google Drive API中的访问令牌和刷新令牌为空 - Access Token and Refresh token are null in google drive api with service account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM