Next.js 允许您使用服务器端 (SSR) 或静态客户端 (SSG) 渲染来构建站点,但当您运行时,next build && next export它会删除/api路由。
例如,由于 NextAuth.js 依赖于这些路由/api/auth/signin,因此如何为 SSG 实现 NextAuth.js?
是否可以使用 Google 工作负载联合身份验证的 OIDC 方法来验证我的 Python 应用程序的 Google Cloud Storage 包。
我想做这样的事情:
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = str(os.path.dirname(os.path.dirname(__file__))) + "/keys/credentials.json"
from google.cloud import storage
import google.oauth2.id_token
import google.auth.transport.requests
request = google.auth.transport.requests.Request()
target_audience = "https://pubsub.googleapis.com"
obtained_id_token = google.oauth2.id_token.fetch_id_token(request, target_audience)
storage_client = storage.Client(credentials=obtained_id_token)
Run Code Online (Sandbox Code Playgroud)
这会产生以下错误:
ValueError: This library only supports credentials from google-auth-library-python. See https://google-auth.readthedocs.io/en/latest/ for help on authentication with this library.
python google-cloud-storage google-cloud-platform openid-connect
不确定哪个选项是最新的最佳实践?我继续阅读本教程:
https://www.postgresqltutorial.com/postgresql-identity-column/
PostgreSQL 版本 10 引入了一个新的约束 GENERATED AS IDENTITY,它允许您自动为列分配一个唯一的数字。
GENERATED AS IDENTITY 约束是旧的SERIAL 列的符合SQL 标准的变体。
在示例中,他们使用身份作为主键:
CREATE TABLE color (
color_id INT GENERATED ALWAYS AS IDENTITY,
color_name VARCHAR NOT NULL
);
Run Code Online (Sandbox Code Playgroud)
当您按照以下方式引用此表以获取外键时:
CREATE TABLE pallet (
id INT GENERATED ALWAYS AS IDENTITY,
color_1 REFERENCES color
color_2 REFERENCES color
);
Run Code Online (Sandbox Code Playgroud)
它现在会知道身份是主键吗?:
为什么当我使用 Visual Studio Code 扩展“Cloud Code”来部署 Cloud Run 服务时,它似乎将图像内容存储在 Cloud Storage(通过 Container Registry)中。
我可以让它将图像存储在 Google Cloud Artifact Registry 中吗?
google-cloud-platform google-cloud-run google-cloud-code google-artifact-registry