OP Corporate Banking APIs Token management (1.0)

Download OpenAPI specification:Download


OP Corporate Banking APIs Token management enables OP corporate customers to access OP Corporate Banking APIs.

Authentication

Authentication in OP Corporate Banking APIs is based on practices from OpenID Connect (OIDC) 1.0 and OAuth 2.0. No user authentication is required (OAuth2.0 server-to-server client credentials flow is followed).

Security Considerations

It is extremely important that the client ID, client secret and client certificate private key are not exposed at any point. Together they represent the identity of the client and thereby the corporation. In the possession of an attacker they could be used to make fraudulent API calls potentially causing considerable damage.

Change log

V1.0 (12/2019)

Initial version

Generate access token

The service generates an access token

Request Body schema: application/x-www-form-urlencoded
required
grant_type
required
string
Value: "client_credentials"

Access token grant type, to be set always as 'client_credentials'.

client_id
required
string

Client ID (to be retrieved from OP API Admin)

client_secret
required
string

Client secret (to be retrieved from OP API Admin)

Responses

Request samples

#!/bin/bash

# To run this you need openssl and jq installed.

# Steps for registering the required keys and certificates
# 1. Valid Corporate API contract created through OP API Admin
# 2. OAuth clientId and clientSecret provisioned
# 3. mTLS private key generated: openssl genrsa -out sandbox-mtls.key 4096
# 4. mTLS certificate signing request (CN and other attributes are ignored):
  openssl req -new -key sandbox-mtls.key -out sandbox-mtls.csr
# 5. Valid mTLS certificate aquired from OP API Admin using the csr from 
  step 4. and in "sandbox-mtls.crt" file

# OAuth credentials
clientId="TODO put here oauth client id"
clientSecret="TODO and here client secret"

# MTLS credentials
mtlsKey="sandbox-mtls.key"
mtlsCertificate="sandbox-mtls.crt"

API_SERVER="https://api.corp-api-sandbox.test.aws.op-palvelut.net"

echo "Getting access token"

reply=$(curl -s ${API_SERVER}/corporate-oidc/v1/token \
  --key ${mtlsKey} \
  --cert ${mtlsCertificate} \
  -H 'Content-Type:application/x-www-form-urlencoded' \
  -d "grant_type=client_credentials&client_id=${clientId}&client_secret=${clientSecret}")
    
token=$(echo $reply | jq -r .access_token)
echo "Access token is: $token"

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZDQkMt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