Create authenticated session from javascript based authentication

Is there a way to use the authenticated session from the browser created by this helper javasscript and start an authenticated session on the server using the authentication information from browser?



There are no built-in ServiceStack auth providers which work with this javascript, but you can create you custom auth provider which will perform this functionality. From what I understand with this library, client script gets oauth token and use it on consequent requests to server. The flow could be following:

  • After receiving token JS sends auth request to ServiceStack /auth/customauthprovider with token as parameter.
  • CustomAuthProvider validates this token on the server which issued the token and receives info about user, fills the session with user data and set that session is authenticated.
  • All consequent calls from client to ServiceStack will be authenticated.

But need to handle this thing: if user renews the token on the client then script should call auth logout and auth login on ServiceStack server to update the user info otherwise the user still be able logged in with expired token.