Automattic / Automattic/wpcom-oauth-cors

error handling

Open
#8 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
6
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Hello :)

I'm using this on a project and am wondering how best to handle errors. Currently, it appears as though [another request will be made](https://github.com/Automattic/wpcom-oauth-cors/blob/master/index.js#L134) if there is no `access_token` in the response and nothing in `localStorage`.

That makes sense but I'd prefer a `Promise` back and then document how to re-request?

So it is possible to do something like:

``` js
wpcomOAuth.get()
.then(function(value) {
// fulfillment
}, function(reason) {
// rejection
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with index.js around line 134 and trace the get() flow when the response has no access_token and localStorage has no token. Define the rejection behavior and document how callers can request authorization again; done means get() supports the shown fulfillment/rejection pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
authentication
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.