OAuth
Authorizes a user via OAuth to connect an application.
OAuth authorization URL construction: {GLOBAL_SETTINGS_DOMAIN}/api/v1/oauth/authorize?client_id={CLIENT_ID}&response_type=code&redirect_uri={REDIRECT_URI}&state={STATE}
After authorization, you will receive the authorization code and the provided state as query parameters in the redirect URL: {REDIRECT_URI}?code={AUTHORIZATION_CODE}&state={PROVIDED_STATE}
For {GLOBAL_SETTINGS_DOMAIN}, use the domain of your Flosum Global Settings instance (for example, global-us.flosum.app).
You can find the {CLIENT_ID} in your connected app under Global Settings > Security > Connected Apps.
Redirects to the redirect URI with the authorization code and state as query parameters in the URL.
GET /api/v1/oauth/authorize HTTP/1.1
Accept: */*
{
"url": "text",
"status": 1
}Exchanges an authorization code or refresh token for an access token.
First, obtain an authorization code via the OAuth /authorize endpoint, then pass it to the /token endpoint: {GLOBAL_SETTINGS_DOMAIN}/api/v1/oauth/token?grant_type=authorization_code&code={CODE}&redirect_uri={REDIRECT_URI}&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}
After a successful request, you will get a response containing a refresh_token. You can use it to get a new access token by passing it to the token endpoint: {GLOBAL_SETTINGS_DOMAIN}/api/v1/oauth/token?grant_type=refresh_token&refresh_token={REFRESH_TOKEN}&redirect_uri={REDIRECT_URI}&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}
You can get {CLIENT_ID} and {CLIENT_SECRET} in your connected app under Global Settings > Security > Connected Apps.
OAuth grant type
Authorization code extracted from the OAuth /authorize response parameters (used when grant_type=authorization_code).
abc123def456ghi789Refresh token extracted from the OAuth /token response parameters (used when grant_type=refresh_token).
abcd0123efgh4567ijkl8901mnop2345qrst6789uvwx0123yzab4567cdef8901ghij2345Allowed redirect URI
https://yourapp.com/oauth/callbackClient identifier (from connected app)
fci_abC12_dEfGhijkLMnopQrsClient secret (from connected app)
abCdEF1gHiJKl_mn-op234qrst56789uvWXyzAbcDEfReturns access_token, refresh_token, and expires_in (in seconds).
POST /api/v1/oauth/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 309
"grant_type='authorization_code'&code='abc123def456ghi789'&refresh_token='abcd0123efgh4567ijkl8901mnop2345qrst6789uvwx0123yzab4567cdef8901ghij2345'&redirect_uri='https://yourapp.com/oauth/callback'&client_id='fci_abC12_dEfGhijkLMnopQrs'&client_secret='abCdEF1gHiJKl_mn-op234qrst56789uvWXyzAbcDEf'"{
"access_token": "text",
"token_type": "text",
"refresh_token": "text",
"expires_in": 1
}Última actualización
¿Te fue útil?