Skip to main content
2 of 2
edited tags
Brock Adams
  • 13k
  • 5
  • 39
  • 64

Same access token between different fetch_token requests

TL;DR:

Is it (or would it be) possible to get the same access_token from one fetch_token request to another, provided that the user is the same?

Scenario:

  1. An anonymous user authenticates with Stack Exchange on my website
  2. He does some stuff which I save in my db (for instance he says he likes blue)
  3. The day after, he visits my website again with another browser/computer
  4. He tries to authenticate with his Stack Exchange account again
  5. Obviously, I want to make sure that he logs on my site with the account he created in 1.

The problem:

Currently, the access_token given in 4. will be different than the one given in 1. which has the following downsides:

  • Each time someone logs in my website with his Stack Exchange account, I can't simply use the access_token to check if the user already exists in my db. I have to make one more request to get his account_id and check with that
  • Which in turn, also forces me to store Stack Exchange's account_id in my db
Jivan
  • 141
  • 4