Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: handle token expiry #3847

Merged
merged 4 commits into from
Jun 3, 2020
Merged

Fix: handle token expiry #3847

merged 4 commits into from
Jun 3, 2020

Conversation

erezrokah
Copy link
Contributor

@erezrokah erezrokah commented Jun 2, 2020

Fixes #3779 (shows a relevant message as we can't refresh a Bitbucket implicit token: https://developer.atlassian.com/cloud/bitbucket/oauth-2/#refresh-tokens)

Fixes #941

Related netlify/gotrue-js#83

Token expiry can happen in the following cases:

  • Web Application Flow - Revoking OAuth app from the relevant GitHub/GitLab/Bitbucket interface. Relevant config is:
backend:
  name: github/gitlab/bitbucket
backend:
  name: git-gateway
  • Bitbucket implicit grant - invalidates after 1 hour and can't be refreshed.
    Relevant config is:
backend:
  name: bitbucket
  repo: owner/repo
  auth_type: implicit
  app_id: 'Bitbucket OAuth Consumer key'
  • Bitbucket Web Application Flow - invalidates after 1 hour and auto refreshed by the CMS.
    Relevant config is:
backend:
  name: bitbucket
  repo: owner/repo
  • GitLab implicit grant - not sure, from the example in the docs it seems it expires in 1 hour - did not experience that issue: https://docs.gitlab.com/ee/api/oauth2.html#implicit-grant-flow, and the example in the response seems wrong: http://myapp.com/oauth/redirect#access_token=ABCDExyz123&state=YOUR_UNIQUE_STATE_HASH&token_type=bearer&expires_in=3600
    The response when doing implicit auth doesn't have an expires_in argument.
    Relevant config is:
backend:
  name: gitlab
  repo: owner/repo
  auth_type: implicit
  app_id: 'GitLab Application ID'

Solution

  • Periodically check that the user is logged in and show a sticky notification error until the user logs out.

Also relevant to #3334

@erezrokah erezrokah requested a review from a team June 2, 2020 13:53
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Jun 2, 2020
@erezrokah erezrokah merged commit 285c940 into master Jun 3, 2020
@erezrokah erezrokah deleted the fix/handle_token_failures branch June 3, 2020 09:46
vladdu pushed a commit to vladdu/netlify-cms that referenced this pull request Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
1 participant