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

Issue #64: [SDK] Error messaging for unauthorized users #70

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

jahabeebs
Copy link
Member

closes #64

Description

  • Now we check to see if window is undefined before calling signOut (we need a browser environment to sign out the user) but now API calls using our axios client shouldn't throw errors
  • To change the error messaging from "Unauthorized" I would need to modify keyp-app's middleware.js:
unauthorized error message

what do you think about me changing this messaging to be "Unauthorized: Invalid access token or forbidden"?

Screenshots

Checking if window exists prevents "window is undefined" error from being thrown (photo 1/2)

check if window exists

No "window is undefined" error thrown at end of error response (photo 2/2)

no error at end of response

@jahabeebs jahabeebs self-assigned this Jun 27, 2023
@github-actions
Copy link

📦 PR Package Available

Use the commands below to install the most recent version of the package(s) in this Pull Request. To install from a specific commit, use the version shown in the relevant Github Action run.

yarn add @usekeyp/js-sdk@PR70 

# If using the Github registry (For Yarn v3, use above command)
yarn add @usekeyp/js-sdk@PR70 --registry https://npm.pkg.github.com
:octocat: 🔒 Click here for instructions on installing this package from the github registry.

Github Registry

You must follow these instructions if using the Github registry. If you can view this repo, then you probably have access to this package(s). Contact the repo owner if you're unsure.

In your Github settings, create a personal access token with read:packages permission (learn more). Add the following lines to ~/.npmrc using your token (learn more).

//npm.pkg.github.com/:_authToken=<YOUR-TOKEN>

For Yarn v3 users, add the following code in your .yarnrc.yml file. Don't forget to gitignore this file!

npmRegistries:
  https://npm.pkg.github.com:
    npmAlwaysAuth: true
    npmAuthToken: "<YOUR-TOKEN>"

NPM Registry

If the package is available on the public NPM registry then you can stop here, and install the package immediately. If using npm private packages, the owner must first grant you access before continuing.

In your NPM account create a new Access Token with Read-only permissions. Add the following lines to ~/.npmrc using your token (learn more).

//registry.npmjs.org/:_authToken=<YOUR-TOKEN>

For Yarn v3 users add the following code in your .yarnrc.yml file. Don't forget to gitignore this file!

npmRegistries:
  https://registry.npmjs.org:
    npmAlwaysAuth: true
    npmAuthToken: "<YOUR-TOKEN>"

Copy link
Member

@pi0neerpat pi0neerpat left a comment

Choose a reason for hiding this comment

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

Tested and works great thanks!

@jahabeebs jahabeebs merged commit e6fd6a5 into dev Jun 28, 2023
1 check 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.

[SDK] Error messaging for unauthorized users
2 participants