Login API

The Login API provides programmatic access to the API Portal, allowing you to integrate login and authentication flows directly in your custom application. To access the API, request an access token or revoke an access token by accessing the OAuth 2.0 authorization endpoint.
apip42
The Login API provides programmatic access to the API Portal, allowing you to integrate login and authentication flows directly in your custom application. To access the API, request an access token or revoke an access token by accessing the OAuth 2.0 authorization endpoint.
SSO (SAML or CA SSO) users cannot log in to Portal using the login API; they have to use the 
API Developer Portal
 login page.
Supported tasks include:
  • Retrieving the scope and identifier of an application that was created through the Mobile Developer Console (MDC) by accessing the 
    /application/{tenantId}
    endpoint
  • Retrieving the session status of an OpenID application 
  • Retrieving the details of an OpenID application user
All requests and responses are in JSON format.
To get an access token, follow these steps:
  • Step 1: Retrieve client_id (
    apikey
    ) from the 
    /application/<tenantId>
     endpoint.
  • Step 2: Use the client_id retrieved in step 1 and use the
    /login/
    auth/oauth/v2/authorize
     endpoint.
Step 1: Retrieve client_id 
The following example accesses the 
application
 RESTful resource from the 
apim-ssg.dev.ca.com
 CA API Gateway: 
curl -k https://apim-ssg.dev.ca.com:8443/login/application/apim
 A response similar to the following example is expected: 
{
    "apikey": "1234abc1c20ea555b59def43f7ebf01234",
    "scope": "openid"
}
Step 2: Use the client_id
Use the client_id with the OAuth 2 resource password flow, but do not include the
client_secret
.
The following code is an example of how to use the API:
curl 'https://apim-ssg-apim-trial1-uswest2.app.services.ostest1.dev.ca.com/login/auth/oauth/v2/token' --data
'client_id=5a6050112e77410a9ce2276c7c709643&grant_type=password&scope=OOB&username=sell2\test&password=CAdemo123!&login_hint=sell2'
Get Session and User Information
You can use the access token to retrieve session information and user info for a specific user.
To get session and user information:
  1. Retrieve session information and user info for a specific user from the 
    /openid/connect/v1/userinfo
     endpoint.
  2. Validate session information from the 
    /connect/session/status
     endpoint.
Login API Description
To explore the
Login API:
  1. Go to Portal and select
    Publish
  2. Select
    API Explorer
  3. Select 
    Login API
     from the
    API
    drop-down list. 
    Alternatively, download the Login API JSON file from login-swagger-4.1.json, then open the file in a swagger UI console or editor.