I'm trying to call context.idToken but it always on failure

Hi Team,
I’m Trying custom authentication login by using my own api.
Upto user login etc are working but unfortunately context.idToken call giving error.
Here is my sample code
if (response.statusCode === 200) {
context.idToken[‘http://localhost:8081/***/***/parse_session_token’] = JSON.parse(body).sessionToken;
return callback(null,user, context);
}
Upto the if call is working fine, but when it debug to context.idToken it throwing error.
Below i am attaching the error

TypeError: Cannot set property ‘http://localhost:8081/***/***/parse_session_token’ of undefined.

Please help me about this issue.

Thanks in Advance…

Hi,

As per the code you shared above you are trying to set idToken in the code. Please correct me if i am wrong.

Hi Rashid,
yes after login i will get the session token so i’m trying to set that token.
here is the example that i’m using
rules/parse.js at master · auth0/rules · GitHub
with the above example i tried the custome authentication adapter.
If there is any wrong pls mention.

Thanks in Advance