Skip to content

Session Handling and Token Invalidation #161

Answered by MarshalX
Vadimkin asked this question in General
Discussion options

You must be logged in to vote

I collected all my thoughts and knowledge about it on the dedicated docs page: https://atproto.blue/en/latest/atproto_client/auth.html

Also, starting from v0.0.41 SDK provides a new callback to receive session string changes which will help you to write proper work and avoid "expired token" errors.

tldr:

from atproto import Client, SessionEvent, Session


client = Client()

@client.on_session_change
def on_session_change(event: SessionEvent, session: Session):
    print(event, session)

new advanced example: https://github.com/MarshalX/atproto/blob/main/examples/advanced_usage/session_reuse.py

i hope it will help you all. mark as the answer for now

Replies: 16 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Vadimkin
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@MarshalX
Comment options

@grantmcconnaughey
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by MarshalX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #158 on September 20, 2023 09:50.