Sample code for 30+ languages & platforms
Lua

OneLogin OIDC - Get Discovery Document (OpenID Connect)

See more OneLogin OIDC Examples

Downloads the OpenID Connect self-discovery document for a OneLogin OIDC enabled app.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.

local http = chilkat.Http.new()

http.accept = "application/json"

local resp = chilkat.HttpResponse.new()
local success = http:http_no_body("GET", "https://<account>.onelogin.com/oidc/.well-known/openid-configuration", resp)
if not success then
    print(http.last_error_text)
    return
end

print("Response Status Code: " .. resp.status_code)

local jsonResponse = chilkat.JsonObject.new()
jsonResponse:load(resp.body_str)
jsonResponse.emit_compact = false
print(jsonResponse:emit())

if resp.status_code ~= 200 then
    print("Failed.")
    return
end

-- Sample output...
-- (See the parsing code below..)
--
-- Use the this online tool to generate parsing code from sample JSON:
-- Generate Parsing Code from JSON

-- {
--   "acr_values_supported": [
--     "onelogin:nist:level:1:re-auth"
--   ],
--   "authorization_endpoint": "https://chilkat-dev.onelogin.com/oidc/auth",
--   "claims_parameter_supported": true,
--   "claims_supported": [
--     "acr",
--     "auth_time",
--     "company",
--     "custom_fields",
--     "department",
--     "email",
--     "family_name",
--     "given_name",
--     "groups",
--     "iss",
--     "locale_code",
--     "name",
--     "params",
--     "phone_number",
--     "preferred_username",
--     "sid",
--     "sub",
--     "title",
--     "updated_at"
--   ],
--   "grant_types_supported": [
--     "authorization_code",
--     "implicit",
--     "refresh_token",
--     "client_credentials",
--     "password"
--   ],
--   "id_token_signing_alg_values_supported": [
--     "RS256"
--   ],
--   "issuer": "https://openid-connect.onelogin.com/oidc",
--   "jwks_uri": "https://chilkat-dev.onelogin.com/oidc/certs",
--   "request_parameter_supported": false,
--   "request_uri_parameter_supported": false,
--   "response_modes_supported": [
--     "form_post",
--     "fragment",
--     "query"
--   ],
--   "response_types_supported": [
--     "code",
--     "id_token token",
--     "id_token"
--   ],
--   "scopes_supported": [
--     "openid",
--     "name",
--     "profile",
--     "groups",
--     "email",
--     "params",
--     "phone"
--   ],
--   "subject_types_supported": [
--     "public"
--   ],
--   "token_endpoint": "https://chilkat-dev.onelogin.com/oidc/token",
--   "token_endpoint_auth_methods_supported": [
--     "client_secret_basic",
--     "client_secret_post",
--     "none"
--   ],
--   "userinfo_endpoint": "https://chilkat-dev.onelogin.com/oidc/me",
--   "userinfo_signing_alg_values_supported": [
--   ],
--   "code_challenge_methods_supported": [
--     "S256"
--   ],
--   "introspection_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/introspection",
--   "introspection_endpoint_auth_methods_supported": [
--     "client_secret_basic",
--     "client_secret_post",
--     "none"
--   ],
--   "revocation_endpoint": "https://chilkat-dev.onelogin.com/oidc/token/revocation",
--   "revocation_endpoint_auth_methods_supported": [
--     "client_secret_basic",
--     "client_secret_post",
--     "none"
--   ],
--   "claim_types_supported": [
--     "normal"
--   ]
-- }
--

local strVal = ""

local authorization_endpoint = jsonResponse:string_of("authorization_endpoint")
local claims_parameter_supported = jsonResponse:bool_of("claims_parameter_supported")
local issuer = jsonResponse:string_of("issuer")
local jwks_uri = jsonResponse:string_of("jwks_uri")
local request_parameter_supported = jsonResponse:bool_of("request_parameter_supported")
local request_uri_parameter_supported = jsonResponse:bool_of("request_uri_parameter_supported")
local token_endpoint = jsonResponse:string_of("token_endpoint")
local userinfo_endpoint = jsonResponse:string_of("userinfo_endpoint")
local introspection_endpoint = jsonResponse:string_of("introspection_endpoint")
local revocation_endpoint = jsonResponse:string_of("revocation_endpoint")
local i = 0
local count_i = jsonResponse:size_of_array("acr_values_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("acr_values_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("claims_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("claims_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("grant_types_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("grant_types_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("id_token_signing_alg_values_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("id_token_signing_alg_values_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("response_modes_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("response_modes_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("response_types_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("response_types_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("scopes_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("scopes_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("subject_types_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("subject_types_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("token_endpoint_auth_methods_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("token_endpoint_auth_methods_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("userinfo_signing_alg_values_supported")
while i < count_i do
    jsonResponse.i = i
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("code_challenge_methods_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("code_challenge_methods_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("introspection_endpoint_auth_methods_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("introspection_endpoint_auth_methods_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("revocation_endpoint_auth_methods_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("revocation_endpoint_auth_methods_supported[i]")
    i = i + 1
end

i = 0
count_i = jsonResponse:size_of_array("claim_types_supported")
while i < count_i do
    jsonResponse.i = i
    strVal = jsonResponse:string_of("claim_types_supported[i]")
    i = i + 1
end