Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue refreshing token #72

Open
colinbes opened this issue Aug 2, 2019 · 7 comments
Open

issue refreshing token #72

colinbes opened this issue Aug 2, 2019 · 7 comments

Comments

@colinbes
Copy link

colinbes commented Aug 2, 2019

I am using refreshable and cookie options for session handling.

OneOff option works as expected but I am unable to get the refreshable option to work.

Setting session max-age to less than refresh max-age results in session timing (as expected).

If using directive requiredSession and session expires I get the following exception thrown (appears to be thrown by processing of directive:

LB, 13:15:43.135UTC ERROR[TheSystem-akka.actor.default-dispatcher-9] ActorSystemImpl - Error during processing of request: 'java.lang.NullPointerException (No error message supplied)'. Completing with 500 Internal Server Error response. To change default exception handling behavior, provide a custom ExceptionHandler. 
java.lang.NullPointerException: null
	at scala.concurrent.impl.Promise$Transformation.<init>(Promise.scala:382)
	at scala.concurrent.impl.Promise$DefaultPromise.flatMap(Promise.scala:140)
	at com.softwaremill.session.RefreshTokenManager.sessionFromValue(SessionManager.scala:180)
	at com.softwaremill.session.RefreshTokenManager.sessionFromValue$(SessionManager.scala:177)

I see the same behavior if I use directive optionalSession.

My understanding is that the refreshing of token (if using cookie based continuity) is done behind the scenes with no required interaction - is this correct?

Am I missing something? I assume I must be doing something wrong as I would imagine this issue would have been reported.

@colinbes
Copy link
Author

colinbes commented Jun 9, 2021

Updated and cleaned up thread.

@colinbes
Copy link
Author

Any ideas/comments? Not having a refresh cookie option (not working for me) means I’ll have to switch to using header option.

@colinbes
Copy link
Author

In effort to further debug I changed using optionalSession directive for session as I read somewhere it offer more debug logging - well, lo and behold, using session works - so not sure what's up with using optionalSession.

This fails with NullPointer exception when session token expires

myOptionalSession.flatMap {
        case Some(session) => {
        ....

while this works

     mySession.flatMap { session =>
        val sessionM: Option[TheSession] = session.toOption

        sessionM match {
          case Some(session) => {
         ...

where

    val myOptionalSession: Directive1[Option[TheSession]] = optionalSession(refreshable, usingCookies)
    def mySession = session(refreshable, usingCookies)

@colinbes
Copy link
Author

Sad to not be seeing responses, hopefully this project is still going to be supported.

@adamw
Copy link
Member

adamw commented Jun 17, 2021

Thanks for the report, it will take a bit unfortunately before we get some free time to try and debug the issue. One thing that does go faster, though, is if you'd have a PR :)

@colinbes
Copy link
Author

colinbes commented Jun 17, 2021 via email

@adamw
Copy link
Member

adamw commented Jun 17, 2021

Sure, documenting the discovery process is definitely a good idea :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants