Menu

A refresh you cannot keep: re-authorizing Bitbucket Cloud import
📰

A refresh you cannot keep: re-authorizing Bitbucket Cloud import

DEV Community: ruby·Priyanshu Jha·about 11 hours ago
#7I9TWLnO
#devtoruby#devto#dev#token#session
Long article (1300 words) — no AI summary yet.
Reading 0:00
15s threshold

Bitbucket Cloud access tokens last about two hours. The import page only needs them while you are on that page. Refreshing the token in the session looked like the right fix, until a reviewer pointed out that the refresh itself was the problem.

This is the story of gitlab-org/gitlab!272089 . I'll cover the issue that asked us to persist a rotated refresh token, the first version that tried to do that, the review that replaced it with a re-authorize flow, and the later comments that kept import polling from kicking the user out mid-import.

The issue: a refresh token that was already dead

The issue was gitlab-org/gitlab#640895 , opened by Jasmin Taj Shaik. Import::BitbucketController could refresh an expired Bitbucket OAuth token, but it never wrote the new credentials back into the session.

Bitbucket Cloud rotates refresh tokens. The previous refresh token is invalid after the first refresh.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.