Open NWuensche opened 2 years ago
Hi @NWuensche , How you are persisting authstate can you please add some examples for reference?
Thanks in advance
Hello,
I'm coming from the Android-Site, so I would probably store it in an SharedPreferences-Manager (a key-value storage):
authState.onUpdateListener(new AuthStateUpdateListener() {
@Override public void execute(
AuthState newAuthState) {
sharedPreferences.putString("authState" newAuthState.toJson());
})
}
On Di, 07. Mär 22:48, GitHub Notifications wrote:
Hi @NWuensche , How you are persisting authstate can you please add some examples for reference?
Thanks in advance
-- Reply to this email directly or view it on GitHub: https://github.com/openid/AppAuth-Android/issues/871#issuecomment-1459625133 You are receiving this because you were mentioned.
Message ID: @.***>
Thanks, @NWuensche. As you have worked on AppAuth can you please help me with the issue where I need to intercept app auth calls and retrieve all the request header, response header, and cookies from API calls so that I can pass that to the further call for session maintenance? I am not able to capture all the data from API can you pls help me with this issue?
Sorry, unfortunately I cannot.
@bhavnamulani see https://github.com/openid/AppAuth-Android#customizing-the-connection-builder-for-http-requests
Back on topic: As a maintainer I've always viewed performActionWithFreshTokens()
as a convenience method for prototyping rather than the way to do authenticated calls long term.
I've seen apps use this successfully in production but when needing more control, devs should take hold of the refresh process.
Possibly a duplicate of #287?
Feature Request
Motivation
When using the AuthState class, persistence is essential after updating the AuthState-Object as explained in the README.md. However, it is not that easy to keep track of when the AuthState was explizitly or implicitly updated (e.g. with
AuthState#performActionWithFreshTokens
) .Description
A new method, called
AuthState.onUpdateListener(listener: AuthStateUpdateListener)
, will be added to the AuthState class. Everytime the authState.update-Method gets executed, the installed listeners will be called. For exampleAlternatives or Workarounds
Currently, I have to take a lot of care of when the authState object has been updated to not forget to persist it.