Sample code for 30+ languages & platforms
Xbase++

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 Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL oResp
LOCAL oJsonResponse
LOCAL cAuthorization_endpoint
LOCAL nClaims_parameter_supported
LOCAL cIssuer
LOCAL cJwks_uri
LOCAL nRequest_parameter_supported
LOCAL nRequest_uri_parameter_supported
LOCAL cToken_endpoint
LOCAL cUserinfo_endpoint
LOCAL cIntrospection_endpoint
LOCAL cRevocation_endpoint
LOCAL i
LOCAL nCount_i
LOCAL cStrVal

nSuccess := 0

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

oHttp := CreateObject("Chilkat.Http")

oHttp:Accept := "application/json"

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpNoBody("GET", "https://<account>.onelogin.com/oidc/.well-known/openid-configuration", oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oResp:destroy()
    RETURN
ENDIF

? "Response Status Code: " + Str(oResp:StatusCode)

oJsonResponse := CreateObject("Chilkat.JsonObject")
oJsonResponse:Load(oResp:BodyStr)
oJsonResponse:EmitCompact := 0
? oJsonResponse:Emit()

IF (oResp:StatusCode != 200)
    ? "Failed."
    oHttp:destroy()
    oResp:destroy()
    oJsonResponse:destroy()
    RETURN
ENDIF

//  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"
//    ]
//  }
//  

cAuthorization_endpoint := oJsonResponse:StringOf("authorization_endpoint")
nClaims_parameter_supported := oJsonResponse:BoolOf("claims_parameter_supported")
cIssuer := oJsonResponse:StringOf("issuer")
cJwks_uri := oJsonResponse:StringOf("jwks_uri")
nRequest_parameter_supported := oJsonResponse:BoolOf("request_parameter_supported")
nRequest_uri_parameter_supported := oJsonResponse:BoolOf("request_uri_parameter_supported")
cToken_endpoint := oJsonResponse:StringOf("token_endpoint")
cUserinfo_endpoint := oJsonResponse:StringOf("userinfo_endpoint")
cIntrospection_endpoint := oJsonResponse:StringOf("introspection_endpoint")
cRevocation_endpoint := oJsonResponse:StringOf("revocation_endpoint")
i := 0
nCount_i := oJsonResponse:SizeOfArray("acr_values_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("acr_values_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("claims_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("claims_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("grant_types_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("grant_types_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("id_token_signing_alg_values_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("id_token_signing_alg_values_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("response_modes_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("response_modes_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("response_types_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("response_types_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("scopes_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("scopes_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("subject_types_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("subject_types_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("token_endpoint_auth_methods_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("token_endpoint_auth_methods_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("userinfo_signing_alg_values_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("code_challenge_methods_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("code_challenge_methods_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("introspection_endpoint_auth_methods_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("introspection_endpoint_auth_methods_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("revocation_endpoint_auth_methods_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("revocation_endpoint_auth_methods_supported[i]")
    i := i + 1
ENDDO
i := 0
nCount_i := oJsonResponse:SizeOfArray("claim_types_supported")
DO WHILE i < nCount_i
    oJsonResponse:I := i
    cStrVal := oJsonResponse:StringOf("claim_types_supported[i]")
    i := i + 1
ENDDO

oHttp:destroy()
oResp:destroy()
oJsonResponse:destroy()