Stay organized with collections
Save and categorize content based on your preferences.
Version 4.0.25.14 (latest)
Present client credentials to obtain an authorization token
Looker API implements the OAuth2 Resource Owner Password Credentials Grant pattern.
The client credentials required for this login must be obtained by creating an API key on a user account
in the Looker Admin console. The API key consists of a public client_id and a private client_secret.
The access token returned by login must be used in the HTTP Authorization header of subsequent
API requests, like this:
Replace "4QDkCy..." with the access_token value returned by login.
The word token is a string literal and must be included exactly as shown.
This function can accept client_id and client_secret parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.
Example of passing credentials in the HTTP request body:
POST HTTP /login
Content-Type: application/x-www-form-urlencoded
client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv
Best Practice:
Always pass credentials in body params. Pass credentials in URL query params only when you cannot pass body params due to application, tool, or other limitations.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# Login\n\nVersion 4.0.25.14 (latest)\n\n### Present client credentials to obtain an authorization token\n\nLooker API implements the OAuth2 [Resource Owner Password Credentials Grant](https://cloud.google.com/looker/docs/r/api/outh2_resource_owner_pc) pattern.\nThe client credentials required for this login must be obtained by creating an API key on a user account\nin the Looker Admin console. The API key consists of a public `client_id` and a private `client_secret`.\n\nThe access token returned by `login` must be used in the HTTP Authorization header of subsequent\nAPI requests, like this: \n\n Authorization: token 4QDkCyCtZzYgj4C2p2cj3csJH7zqS5RzKs2kTnG4\n\nReplace \"4QDkCy...\" with the `access_token` value returned by `login`.\nThe word `token` is a string literal and must be included exactly as shown.\n\nThis function can accept `client_id` and `client_secret` parameters as URL query params or as www-form-urlencoded params in the body of the HTTP request. Since there is a small risk that URL parameters may be visible to intermediate nodes on the network route (proxies, routers, etc), passing credentials in the body of the request is considered more secure than URL params.\n\nExample of passing credentials in the HTTP request body: \n\n POST HTTP /login\n Content-Type: application/x-www-form-urlencoded\n\n client_id=CGc9B7v7J48dQSJvxxx&client_secret=nNVS9cSS3xNpSC9JdsBvvvvv\n\n### Best Practice:\n\nAlways pass credentials in body params. Pass credentials in URL query params **only** when you cannot pass body params due to application, tool, or other limitations.\n\nFor more information and detailed examples of Looker API authorization, see [How to Authenticate to Looker API](https://github.com/looker/looker-sdk-ruby/blob/master/authentication.md).\n\nRequest\n-------\n\nPOST /login \nDatatype \nDescription \nRequest \nHTTP Request \nquery \nHTTP Query \nExpand HTTP Query definition... \nclient_id \nstring \nclient_id part of API Key. \nclient_secret \nstring \nclient_secret part of API Key.\n\nResponse\n--------\n\n### 200: Access token with metadata.\n\nDatatype \nDescription \n(object) \n[AccessToken](/looker/docs/reference/looker-api/latest/types/AccessToken) \naccess_token \n*lock* \nstring \nAccess Token used for API calls \ntoken_type \n*lock* \nstring \nType of Token \nexpires_in \n*lock* \ninteger \nNumber of seconds before the token expires \nrefresh_token \n*lock* \nstring \nRefresh token which can be used to obtain a new access token\n\n### 400: Bad Request\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/latest/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 404: Not Found\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/latest/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link\n\n### 429: Too Many Requests\n\nDatatype \nDescription \n(object) \n[Error](/looker/docs/reference/looker-api/latest/types/Error) \nmessage \n*lock* \nstring \nError details \ndocumentation_url \n*lock* \nstring \nDocumentation link"]]