Parsing custom response from OAuth2 Token endpoint

Hi, I’m adding a new Custom Social Connection to my list of Authentications and I face an issue when parsing a response from Token URL, which is used to get access token.
According to documentation the response from endpoint that provides access token is expected in this format

{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}

But I get a response that looks like that

{
    "$data": {
        "access_token": "6j42gte2lk1n29nte2lqmkk42g1n28nf0lbl9q",
        "refresh_token": "av439q8nlbl0l4309fp39q8nf0mkn43943f09f",
        "expires_in": 3600
    }
}

This is a response from https://ed.link/api/authentication/token doc here

As a result accessToken variable is empty and I cannot use it in my Fetch User Profile Script. How can I customize parsing of Token response body?

I found a solution, instead of using accessToken parameter in fetchUserProfile I can use context. Like this:

function fetchUserProfile(accessToken, ctx, cb) {
  const theToken = ctx.$data.access_token;
  ...
}