Auth0のアクセストークンを取得してみる。
:AUTH0_CLIENT_ID := (getenv "AUTH0_CLIENT_ID")
:AUTH0_CLIENT_SECRET := (getenv "AUTH0_CLIENT_SECRET")
:AUTH0_ORIGIN := (getenv "AUTH0_ORIGIN")
:AUTH0_AUDIENCE := (getenv "AUTH0_AUDIENCE")
POST :AUTH0_ORIGIN/oauth/token
Content-Type: application/json
{
"audience": ":AUTH0_AUDIENCE",
"client_id": ":AUTH0_CLIENT_ID",
"client_secret": ":AUTH0_CLIENT_SECRET",
"grant_type": "client_credentials"
}
以下は取得できた場合のレスポンス。重要な情報についてはデータをマスクした。
{ "access_token": "MASKMASKMASKMASKMASKMASKMASKMASKMASKMASK", "scope": "read:MASK create:MASK", "expires_in": 86400, "token_type": "Bearer" } // POST https://MASKMASKMASK/oauth/token // HTTP/1.1 200 OK // Date: Thu, 12 Nov 2020 01:13:22 GMT // Content-Type: application/json // Transfer-Encoding: chunked // Connection: keep-alive // CF-Ray: MASK // Cache-Control: no-store // Set-Cookie: MASK // Strict-Transport-Security: max-age=31536000 // Vary: Accept-Encoding // CF-Cache-Status: DYNAMIC // cf-request-id: MASK // Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" // ot-baggage-auth0-request-id: MASK // ot-tracer-sampled: true // ot-tracer-spanid: MASK // ot-tracer-traceid: MASK // Pragma: no-cache // Set-Cookie: MASK // X-Auth0-RequestId: MASK // X-Content-Type-Options: nosniff // X-RateLimit-Limit: 1000000 // X-RateLimit-Remaining: 999999 // X-RateLimit-Reset: 1605143603 // Server: cloudflare // Request duration: 55.368420s