Sample code for 30+ languages & platforms
Rust

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 Rust Downloads

Rust

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

let http = chilkat::Http::new();

http.set_accept("application/json");

let resp = chilkat::HttpResponse::new();
if http.http_no_body("GET", "https://<account>.onelogin.com/oidc/.well-known/openid-configuration", &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

println!("Response Status Code: {}", resp.status_code());

let json_response = chilkat::JsonObject::new();
let _ = json_response.load(&resp.body_str());
json_response.set_emit_compact(false);
println!("{}", json_response.emit().unwrap_or_default());

if resp.status_code() != 200 {
    println!("Failed.");
    return;
}

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

let mut i: i32 = 0;
let mut count_i: i32 = 0;

let authorization_endpoint = json_response.string_of("authorization_endpoint").unwrap_or_default();
let claims_parameter_supported = json_response.bool_of("claims_parameter_supported");
let issuer = json_response.string_of("issuer").unwrap_or_default();
let jwks_uri = json_response.string_of("jwks_uri").unwrap_or_default();
let request_parameter_supported = json_response.bool_of("request_parameter_supported");
let request_uri_parameter_supported = json_response.bool_of("request_uri_parameter_supported");
let token_endpoint = json_response.string_of("token_endpoint").unwrap_or_default();
let userinfo_endpoint = json_response.string_of("userinfo_endpoint").unwrap_or_default();
let introspection_endpoint = json_response.string_of("introspection_endpoint").unwrap_or_default();
let revocation_endpoint = json_response.string_of("revocation_endpoint").unwrap_or_default();
i = 0;
count_i = json_response.size_of_array("acr_values_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("acr_values_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("claims_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("claims_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("grant_types_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("grant_types_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("id_token_signing_alg_values_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("id_token_signing_alg_values_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("response_modes_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("response_modes_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("response_types_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("response_types_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("scopes_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("scopes_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("subject_types_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("subject_types_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("token_endpoint_auth_methods_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("token_endpoint_auth_methods_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("userinfo_signing_alg_values_supported");
while i < count_i {
    json_response.set_i(i);
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("code_challenge_methods_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("code_challenge_methods_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("introspection_endpoint_auth_methods_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("introspection_endpoint_auth_methods_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("revocation_endpoint_auth_methods_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("revocation_endpoint_auth_methods_supported[i]").unwrap_or_default();
    i = i + 1;
}

i = 0;
count_i = json_response.size_of_array("claim_types_supported");
while i < count_i {
    json_response.set_i(i);
    let _ = json_response.string_of("claim_types_supported[i]").unwrap_or_default();
    i = i + 1;
}