fix(sync): warn instead of auto-reauth when token is missing
Problem: `with_token` silently triggered an OAuth browser flow when no tokens existed, with no user-facing explanation. Solution: replace the auto-reauth branch with a `log.warn` directing the user to run `:Pending auth`.
This commit is contained in:
parent
fadad3ed95
commit
cfdcff9eba
2 changed files with 2 additions and 20 deletions
|
|
@ -134,16 +134,7 @@ local function with_token(callback)
|
|||
oauth.async(function()
|
||||
local token = oauth.google_client:get_access_token()
|
||||
if not token then
|
||||
oauth.google_client:auth(function()
|
||||
oauth.async(function()
|
||||
local fresh = oauth.google_client:get_access_token()
|
||||
if fresh then
|
||||
callback(fresh)
|
||||
else
|
||||
log.error(oauth.google_client.name .. ': authorization failed or was cancelled')
|
||||
end
|
||||
end)
|
||||
end)
|
||||
log.warn('not authenticated — run :Pending auth')
|
||||
return
|
||||
end
|
||||
callback(token)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue