Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Swift 3,4,5... Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois
Mastercard

MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Swift 3,4,5...) OneLogin OIDC - Get Discovery Document (OpenID Connect)

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

For more information, see https://developers.onelogin.com/openid-connect/connect-to-onelogin

Chilkat Downloads for the Swift Programming Language

MAC OS X (Cocoa) Objective-C/Swift Libs

iOS Objective-C/Swift Libs

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

    let http = CkoHttp()!

    http.accept = "application/json"

    var resp: CkoHttpResponse? = http.quickRequest("GET", url: "https://<account>.onelogin.com/oidc/.well-known/openid-configuration")
    if http.lastMethodSuccess != true {
        print("\(http.lastErrorText!)")
        return
    }

    print("Response Status Code: \(resp!.statusCode.intValue)")

    let jsonResponse = CkoJsonObject()!
    jsonResponse.load(resp!.bodyStr)
    jsonResponse.emitCompact = false
    print("\(jsonResponse.emit()!)")

    if resp!.statusCode.intValue != 200 {
        print("Failed.")
        resp = nil
        return
    }

    resp = nil

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

    var authorization_endpoint: String?
    var claims_parameter_supported: Bool
    var issuer: String?
    var jwks_uri: String?
    var request_parameter_supported: Bool
    var request_uri_parameter_supported: Bool
    var token_endpoint: String?
    var userinfo_endpoint: String?
    var introspection_endpoint: String?
    var revocation_endpoint: String?
    var i: Int
    var count_i: Int
    var strVal: String?

    authorization_endpoint = jsonResponse.string(of: "authorization_endpoint")
    claims_parameter_supported = jsonResponse.bool(of: "claims_parameter_supported")
    issuer = jsonResponse.string(of: "issuer")
    jwks_uri = jsonResponse.string(of: "jwks_uri")
    request_parameter_supported = jsonResponse.bool(of: "request_parameter_supported")
    request_uri_parameter_supported = jsonResponse.bool(of: "request_uri_parameter_supported")
    token_endpoint = jsonResponse.string(of: "token_endpoint")
    userinfo_endpoint = jsonResponse.string(of: "userinfo_endpoint")
    introspection_endpoint = jsonResponse.string(of: "introspection_endpoint")
    revocation_endpoint = jsonResponse.string(of: "revocation_endpoint")
    i = 0
    count_i = jsonResponse.size(ofArray: "acr_values_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "acr_values_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "claims_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "claims_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "grant_types_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "grant_types_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "id_token_signing_alg_values_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "id_token_signing_alg_values_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "response_modes_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "response_modes_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "response_types_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "response_types_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "scopes_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "scopes_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "subject_types_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "subject_types_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "token_endpoint_auth_methods_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "token_endpoint_auth_methods_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "userinfo_signing_alg_values_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "code_challenge_methods_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "code_challenge_methods_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "introspection_endpoint_auth_methods_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "introspection_endpoint_auth_methods_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "revocation_endpoint_auth_methods_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "revocation_endpoint_auth_methods_supported[i]")
        i = i + 1
    }

    i = 0
    count_i = jsonResponse.size(ofArray: "claim_types_supported").intValue
    while i < count_i {
        jsonResponse.i = i
        strVal = jsonResponse.string(of: "claim_types_supported[i]")
        i = i + 1
    }


}

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.