Skip to content

Conversation

@jzunigax2
Copy link

@jzunigax2 jzunigax2 commented Dec 1, 2025

Implement auth flow, following the Box backend.

SSO Authentication Flow:

  • Local callback server for browser-based SSO login
  • Automatic browser launch with redirect URI
  • Secure mnemonic and token capture

Automatic Token Refresh (Box Backend Pattern)

  • Continuous background token monitoring via oauthutil.NewRenew()
  • Prevents mid-operation token expiry failures

Follows Box backend JWT implementation (backend/box/box.go) for:

  • Token renewal setup (lines 506-522)
  • Refresh callback pattern (lines 197-217)

@jzunigax2 jzunigax2 self-assigned this Dec 1, 2025
@jzunigax2 jzunigax2 changed the title internxt: Implement authentication handling [PB-5453]: feat token based auth Dec 2, 2025
@jzunigax2 jzunigax2 requested a review from larryrider December 2, 2025 23:16
@jzunigax2 jzunigax2 changed the title [PB-5453]: feat token based auth [PB-5453]: feat/token based auth Dec 3, 2025
@jzunigax2 jzunigax2 marked this pull request as ready for review December 3, 2025 20:23
info.RootFolderID = resp.User.RootFolderID
fs.Debugf(nil, "Using RootFolderID from refresh response: %s", info.RootFolderID)
} else if resp.User.UUID != "" {
info.RootFolderID = resp.User.UUID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? I think that the user.uuid cannot be used as the rootFolderId 🤔

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that made no sense I must have been trying to get this from somewhere else as a sort of fallback. but I just streamlined this code since we call refresh anyway just like cli does there is no point in attempting to get this info from somewhere else. We now just get it from the refresh response

return
}

mnemonicBytes, err := base64.StdEncoding.DecodeString(mnemonicB64)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it could be a good idea to check also if the mnemonic is valid, i dont know about golang dependencies but i think it should exist at least one haha

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, added an explicit mnemonic check now

@jzunigax2 jzunigax2 merged commit 5ab333f into master Dec 15, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants