Authenticate User with OpenID Authentication

Generates a Pyramid access authentication token using OpenID authentication parameter map and custom data

Method

/API3/authentication/authenticateUserOPENID
  • API Section: /API3/authentication
  • API Version: 3.0
  • From Release: 2023.10
  • Usage: REST API and Client SDK libraries. REST APIs via POST actions only.
  • Usage by:
    • Enterprise Admin
    • Domain Admin
    • Pro
    • Analyst
    • Viewer
    • Basic

Method Signature

Input Parameters

Name

userOpenIdCredentials

Object Type

UserOpenIdCredentials

Description

The user credentials for authentication by OpenID parameter map.

Output Response

Successful Result Code

200

Response Type

string

Description of Response Type

The response is the security token as a base64 string. It is usually stored in a cookie.

Notes

The security token is a string that needs to be embedded in every API call to ensure the API calls are authorized. If saved as a cookie in a web browser, it can be used (for the authenticated user) to auto-login into the application. The assumption is that the user has already authenticated via OpenID before attempting to authenticate into Pyramid.

Examples

Authenticate User with OpenID:

This example demonstrates how to authenticate a user using OpenID.

// URL of the Pyramid installation and the path to the API 3.0 REST methods
var pyramidURL = "http://mysite.com/api3/";

// The response from the OpenId authentication var openIdToken = “YOUR_OPEN_ID_TOKEN(RESPONSE)”;

//calling the API to receive the Pyramid token let pyramidToken = callApi( “authentication/authenticateUserOPENID”, { parameterMap: { id_token: openIdToken, state: “preferred_username”, } }, “”, false ); console.log(“fetch: " + pyramidToken);

// ##### generic REST API calling method ############## function callApi(path,data,token=”",parseResult=true){ var xhttp = new XMLHttpRequest(); xhttp.open(“POST”, pyramidURL+path, false); xhttp.setRequestHeader(“paToken”,token) xhttp.send(JSON.stringify(data)); if(parseResult){ return JSON.parse(xhttp.responseText); }else{ return xhttp.responseText; } }

Code Snippets

TypeScript

Curl

Java

C#

Python

PHP

curl -X POST \
 -H "Accept: text/plain,text/plain;charset=utf-8" \
 -H "Content-Type: application/json" \
 "http://Your.Server.URL/API3/authentication/authenticateUserOPENID" \
 -d '{
  "domain" : "domain",
  "idToken" : "idToken",
  "customData" : "customData",
  "parameterMap" : "parameterMap"
}'
import com.pyramidanalytics.*;
import com.pyramidanalytics.auth.*;
import com.pyramidanalytics.model.*;
import com.pyramidanalytics.api.AuthenticationServiceApi;

import java.util.*;
import java.time.*;

public class AuthenticationServiceApiExample {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://Your.Server.URL/");

        // Create an instance of the API class
        AuthenticationServiceApi apiInstance = new AuthenticationServiceApi();
        // Initialize the userOpenIdCredentials parameter object for the call
        UserOpenIdCredentials userOpenIdCredentials = ; // Create the input object for the operation, type: UserOpenIdCredentials 

        try {
            String result = apiInstance.authenticateUserOPENID(userOpenIdCredentials);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AuthenticationServiceApi#authenticateUserOPENID");
            e.printStackTrace();
        }
    }
}
import * as PyramidAnalyticsWebApi from "com.pyramidanalytics";

// Create an instance of the API class
const api = new PyramidAnalyticsWebApi.AuthenticationServiceApi("http://Your.Server.URL")

const userOpenIdCredentials = ; // {UserOpenIdCredentials} 

api.authenticateUserOPENID(userOpenIdCredentials).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});
using System;
using System.Diagnostics;
using PyramidAnalytics.Sdk.Api;
using PyramidAnalytics.Sdk.Client;
using PyramidAnalytics.Sdk.Model;

public class authenticateUserOPENIDExample
{
    public static void Main()
    {
        Configuration conf = new Configuration();
        conf.BasePath = "http://Your.Server.URL/";
        
        
        GlobalConfiguration.Instance = conf;
        
        // Create an instance of the API class
        var apiInstance = new AuthenticationServiceApi();
        // Initialize the userOpenIdCredentials parameter object for the call
        var userOpenIdCredentials = new UserOpenIdCredentials(); // UserOpenIdCredentials | 

        try {
            // Generates a Pyramid access authentication token using OpenID authentication parameter map and custom data
            string result = apiInstance.authenticateUserOPENID(userOpenIdCredentials);
            Debug.WriteLine(result);
        } catch (Exception e) {
            Debug.Print("Exception when calling AuthenticationServiceApi.authenticateUserOPENID: " + e.Message );
        }
    }
}
import com.pyramidanalytics
from com.pyramidanalytics import ApiException
from com.pyramidanalytics import AuthenticationServiceApi
from pprint import pprint

    api_config = com.pyramidanalytics.Configuration(host = 'http://Your.Server.URL')

with com.pyramidanalytics.ApiClient(api_config) as api_client:
    # Create an instance of the API class
    api_instance = AuthenticationServiceApi(api_client)
    # Initialize the userOpenIdCredentials parameter object for the call
    userOpenIdCredentials =  # UserOpenIdCredentials | 

    try:
        # Generates a Pyramid access authentication token using OpenID authentication parameter map and custom data
        api_response = api_instance.authenticate_user_openid(userOpenIdCredentials)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AuthenticationServiceApi->authenticateUserOPENID: %s\n" % e)
<?php
require_once(__DIR__ . '/vendor/autoload.php');

OpenAPITools\Client\Configuration::getDefaultConfiguration()->setHost('http://Your.Server.URL');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AuthenticationServiceApi();
$userOpenIdCredentials = ; // UserOpenIdCredentials | 

try {
    $result = $api_instance->authenticateUserOPENID($userOpenIdCredentials);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationServiceApi->authenticateUserOPENID: ', $e->getMessage(), PHP_EOL;
}
?>