Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Info

Login using OAuth2.0 is available since MediaHaven version 18.4. It is the preferred way of authenticating for new integrations.

...

2. Obtaining a token

Client Credentials Grant a.k.a. interactive flow.

Info

If your app offers a UI, you are required to use this flow

...

Below is an example of the request with cURL. 

Code Block
curl -X POST https://integration.mediahaven.com/auth/ropc.php \
    --data "username=username" \
    --data "password=usernamespassword" \
    --data "client_id=882rgLgNTSqwBSnUUbC3qRiUfMGhorzZ" \
    --data "client_secret=KwfoaaXUDc6xdQKxBwxvxK55D4wZQ757"

If all goes well, you'll receive a  status 200 with the following JSON:

Code Block
{
    "refresh_token":"1INOoUzpcFNa2diTVDGg86696mvJkUdZ",
    "token_type":"bearer",
    "access_token":"WySMF6lvPBsuV4X2tImsXe14zjzb1GEC",
    "expires_in":7200
}
Warning

It's also possible a statuscode != 200 is returned. You must take appropriate action.

...

Code Block
curl -X GET https://integration.mediahaven.com/mediahaven-rest-api/resourcesv2/mediarecords -H "Authorization: bearer WySMF6lvPBsuV4X2tImsXe14zjzb1GEC"

...

Note

When logging in multiple times, it must always be done with the same method as the first time otherwise you will get unauthorized when on the next attempt with a different method. If you wish to switch to a different method the user must be deleted first in MediaHaven.

Flow / Method

SAML
External
Authentication

Active Directory
External Authentication

MediaHaven
Internal
Authentication

https://mediahaven.atlassian.net/wiki/spaces/CS/pages/872251552/OAuth2.0#Client-Credentials-Grant-a.k.a.-interactive-flow.

(tick)

(tick)
(if MediaHaven authentication is allowed in the OAuth portal)

(tick)
(if MediaHaven authentication is allowed in the OAuth portal)

https://mediahaven.atlassian.net/wiki/spaces/CS/pages/872251552/OAuth2.0#Resource-Owner-Password-Credentials

(error)

(tick)

(tick)