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

[PWA-147] Sign Out should revoke customer token using graphql mutation #2012

Merged
merged 6 commits into from
Dec 6, 2019

Conversation

tjwiebell
Copy link
Contributor

@tjwiebell tjwiebell commented Dec 4, 2019

Description

App should revoke Customer token on sign out using GraphQL mutation.

Related Issue

  • [PWA-147] Sign Out should revoke customer token using graphql mutation

Acceptance

Verification Stakeholders

Specification

Verification Steps

  1. Signin with a valid customer/user
  2. Grab the oauth token from local storage
  3. If you see customer details in the app, the token is confirmed working, but worth sanity checking and running an auth'd getCustomer query in a GraphQL client, being sure to append Authorization: Bearer <token> header to request
  4. Signout - verify you no longer see customer details, and page should refresh and take you back to home
  5. Using a GraphQL client, attempt the auth'd getCustomer query again. You should now get The current customer isn't authorized.

Screenshots / Screen Captures (if appropriate)

Checklist

  • I have updated the documentation accordingly, if necessary.
  • I have added tests to cover my changes, if necessary.

- Add test to cover new functionality
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Dec 4, 2019

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: PWA-147.

Generated by 🚫 dangerJS against 50d43be

@tjwiebell tjwiebell added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Dec 4, 2019
// Sign the user out in local storage and Redux.
export const signOut = ({ history, revokeToken }) => async dispatch => {
// Send mutation to revoke token.
await revokeToken();
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically this will return an error if called without a bearer token. Do we care? Probably not, but I would possibly catch and do something with the error just incase.

{
  "errors": [
    {
      "message": "The current customer isn't authorized.",
      "category": "graphql-authorization",
      "locations": [
        {
          "line": 2,
          "column": 5
        }
      ],
      "path": [
        "revokeCustomerToken"
      ]
    }
  ],
  "data": {
    "revokeCustomerToken": null
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 1f680c4

@dpatil-magento dpatil-magento merged commit e38e2ad into develop Dec 6, 2019
@dpatil-magento dpatil-magento deleted the tommy/sign-out-graphql branch December 6, 2019 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:peregrine pkg:venia-ui version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants