The updated getting started sample app obtains the...
# ask-a-descoper
a
The updated getting started sample app obtains the token from an html element with an id "jwt_raw", but never provides that id to the SDK. This appears to be hard coded? Why was the getSessionToken removed? It seems clearner to let the javascript get the token rather than displaying it in the html before redirecting to the app.
b
Hi Michael - Which sample app are you referring to? Can you provide a screenshot?
a
This was updated in the last 2 days
What I would like is to have the auth redirect to a specified url with the token in the headers so the server can validate all requests after the sign-in flow completes without it having to go to back to the login page to get the token.
I re-read the example. Ignore comments it looks like the it is using the returned event to get the data. Now to figureout how to get the refresh token...
b
Hi Michael, So for the refresh token - the SDK automatically sets it in the localStorage or cookies (depending on the project settings). Then when you go in other pages - you can use the SDK to get a session token (
sdk.refresh())
from the refresh token without redirecting the user to the login page.
You can see an example in the flask sample app: https://github.com/descope-sample-apps/flask-sample-app, and how
sdk.refresh()
and then
sdk.getSessionToken()
are used in the other pages to get the session token and make sure it's part of any backend calls.
a
We are using LiveView so server rendered content in many cases. But I hve the 2 tokens and the server can make requests so I should be good.
b
ok cool. let us know if there is anything we can assist with!
a
I have it working for the time being. Thank you all.