LoginV2

Β 

Content

Β 

Setup

This is the documentation of how to obtain an authentication token for the ws.di.no domain.

In order to POST data into the API use a JSON object without name.

  • The token is valid for 30 minutes

  • The token is returned in a json structure with token as key (Β https://jwt.io/Β ) and can be handled as a plain string on the client side

  • New token should be obtained after expiry by calling this endpoint again, not each time another endpoint/service is used

Environments / endpoints

TEST

POST

https://staging-ws.di.no/ws/json/auth/v-2/login

PRODUCTION

POST

https://ws.di.no/ws/json/auth/v-2/login

Making a request

Request headers

Key

Value

Key

Value

Content-Type

application/json

Β 

Request body

Field

Description

Example

Data type

Field

Description

Example

Data type

username

The username that was provided by the DI service desk

myName

String

password

The password that was provided by the DI service desk

secret!23

String

Β 

Curl request example

curl https://ws.di.no/ws/json/auth/v-2/login \ -H "Content-Type:application/json" \ -d "{\"username\": \"myname\", \"password\": \"secret\"}"

Β 

Response

The endpoint replies with a response object in JSON format, containing the following data

Field

Description

Example

Data type

Field

Description

Example

Data type

token

The JWT token to be used in subsequent requests

aVeryLongString

String

The security token should be placed in theΒ Authorization header like this:

"Authorization: Bearer <token>"