Authorization header, as some endpoints may redirect to other URLs.
API Keys
To create an API key, log in into Light, navigate to “Settings” > “API Keys” and click on “Create Key”. Make sure to copy and securely store the generated API key, as it will not be shown again. Light API keys are linked to roles the same way user accounts are. The roles assigned to the API key determine what actions the key can perform. To use API keys for authentication, include theAuthorization header in your requests using Basic Authentication scheme:
OAuth 2.0
Contact Light support at support@light.inc to setup your account for OAuth 2.0 flow
client_id and client_secret. You will also need to provide Light with a redirect URI where users will be sent after they authorize your application.
To initiate the OAuth 2.0 authorization code flow, open the the following URL:
state parameter to this request. Check out the OAuth 2.0 spec for more details on using the state parameter.
Exchanging Authorization Code for Access Token
After the user authorizes your application, they will be redirected back to your specified redirect URI with an authorization code. You can exchange this authorization code for an access token by making a POST request to the token endpoint:access_token field, which you can use to authenticate your API requests. Include the access token in the Authorization header using the Bearer scheme:
refresh_token field and expires_in field, which you can use to obtain a new access token when the current one expires.
Make sure to securely store the access_token, refresh_token and expires_in values so you can refresh the access token when needed.
Refreshing Access Tokens
When your access token expires, you can obtain a new one using the refresh token. Make a POST request to the token endpoint with the following parameters:access_token, refresh_token, and expires_in field. Use the new access token for subsequent API requests.