Issue while setting up a session variable.

Hi Team,

I have an issue while setting up a session variable from the below piece of code. This should ideally set my session variable “access_token” with the scala variable. But this not setting my session and script returns with no access_token variable found error.

private val getJwtToken = exec { session =>
  val loc = session("alef_user").as[String]
  val regex = new Regex("""alef_user=(.+)""")
  val matches = regex.findFirstMatchIn(loc)
  val alef_user = matches.mkString("alef_user")
  val res = alef_user.substring(10, alef_user.length)
  val utf = com.alefeducation.common.DecodeBase64.decodeBase64ToUtf8(res)
  val access_token = com.alefeducation.common.DecodeBase64.getJwtToken(utf).toString

sessions are immutable - calling session.set actually returns a new session object, but then you’re returning the unedited version with the last line.

just remove the final session return

Thanks James. This works.