Versions Compared

Key

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

...

  • Step 1

    • redirect your end user to https://stagingoperated.ochno.com/identity/oauth/v2/authorize?client_id=*clientid*&state=*state*&redirect_uri=*redirect*&scope=*scope*&response_type=code

      • state is your own reference to the session for the user, it will be returned in the redirect

      • scope is a single or array(uri encoded array (scope=scope1%20scope2) etc)

    • End user logs in and authorises the request to fetch data on behalf of him and selected organisation account

    • End user is redirected to the redirect uri with the query parameter code (redirect_uri?code=*authorisation_code*)

    • With the authorisation code call the endpoint(post) https://stagingoperated.ochno.com/identity/oauth/v2/token

      • Parameters

        • code = the authorisation code

        • client_id

        • client_secret

        • grant_type = ‘authorization_code’

        • redirect_uri

        • codeVerifier = random base64 string for your own verification

      • headers

        • "Content-Type" : "application/x-www-form-urlencoded"

    • In the response (if successfull) you will recieve the data object which contains

      • access_token (use this in header - Authorization : Bearer *access_token*)

      • refresh_token (use this to generate new access_tokens + refresh_tokens)

  • Step 2

    • You can now use the API endpoints to fetch data on behalf of the authorised user

    • Supply the access_token in each request - Authorization : Bearer *access_token*

  • Step 3

    • To generate new access_token & refresh_token

      • Endpoint https://stagingoperated.ochno.com/identity/oauth/v2/token (post)

      • Parameters

        • refresh_token

        • client_id

        • client_secret

        • grant_type = ‘refresh_token’

        • redirect_uri

      • headers

        • "Content-Type" : "application/x-www-form-urlencoded"

...

Swagger documentation

https://stagingoperated.ochno.com/doc/swagger