61
submitted 3 years ago* (last edited 3 years ago) by canpolat@programming.dev to c/git@programming.dev

You can use git switch - to switch to the previous branch. In the following example, we see switching back and forth between branches main and my_dev_branch:

C:\git\my-repo [my_dev_branch]> git switch -
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
C:\git\my-repo [main ≡]> git switch -
Switched to branch 'my_dev_branch'
C:\git\my-repo [my_dev_branch]>

Edit: Old habits die hard. Updated to use switch instead of checkout since switch has a clearer responsibility. Obviously they work exactly the same for this scenario.

25
88
49
52
379
submitted 3 years ago* (last edited 3 years ago) by canpolat@programming.dev to c/programmer_humor@programming.dev
47
submitted 3 years ago* (last edited 3 years ago) by canpolat@programming.dev to c/linux@programming.dev
66
Software engineers hate code (www.dancowell.com)
6
submitted 3 years ago* (last edited 3 years ago) by canpolat@programming.dev to c/lemmydev@lemm.ee

I'm working on a test bot to understand the API and I have a question about authentication and JWT validation.

As far as I can see, the way to authenticate is to call the /user/login endpoint with valid credentials which will return a JWT. All is good except the JWT payload. I see that it contains iat but nothing about expiry (exp).

Now, I wanted to use the JWT for multiple requests, but that's difficult if I cannot figure out when the token expires. What is the best way to be sure about the validity of a JWT before using it. Should I get a new JWT before every operation, is that the intended behavior? Or maybe I misunderstand the way authentication works with Lemmy?

Edit: I asked this on Lemmy Development channel a few days ago and apparently someone has created an issue in Github. So, perhaps this will be addressed in a later update.

5
submitted 3 years ago* (last edited 3 years ago) by canpolat@programming.dev to c/git@programming.dev
22
1
view more: ‹ prev next ›

canpolat

0 post score
0 comment score
joined 3 years ago
MODERATOR OF