dobesv / axios-oauth-1.0a Goto Github PK
View Code? Open in Web Editor NEWEasy OAuth-1.0a signing for axios
License: Other
Easy OAuth-1.0a signing for axios
License: Other
const url = new URL('https://example.com/?foo=bar')
const client = axios.create({url: 'https://example.com', params: url.searchParams})
addOAuthInterceptor(client, {
algorithm: 'HMAC-SHA256',
key,
secret,
})
i think the issue is here, because oauthUrl.search
and oauthUrl.searchParams
are both empty when they shouldn't be
https://github.com/dobesv/axios-oauth-1.0a/blob/master/src/index.ts#L117-L122
see axios documentation, params
can be a URLSearchParams
object
I'm planning to use this in my react app for woocommerce request but I get this error
We can not remove interceptor like this example:
const myInterceptor = axios.interceptors.request.use(function () {/*...*/});
axios.interceptors.request.eject(myInterceptor);
Because addOAuthInterceptor
don't return interceptor.
Remove interceptor is useful if we using multiple auth method, like twitter that use Oauth1a, Oauth2 PKCE, Oath2 Bearer only, and other.
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@babel/core
, @babel/preset-env
, @babel/preset-typescript
)@types/jest
, jest
)package.json
oauth-sign ^0.9.0
@babel/core 7.18.6
@babel/preset-env 7.18.6
@babel/preset-typescript 7.18.6
@types/auth-header 1.0.2
@types/jest 28.1.5
@types/node 16.18.44
auth-header 1.0.0
axios 0.27.2
axios-mock-adapter 1.21.1
jest 28.1.3
prettier 2.7.1
typescript 4.7.3
axios >=0.21.0
yarn 3.6.3
.travis.yml
node 14
Hello,
I can't use import method (Cannot use import statement outside a module)
And when I user the require method : "addOAuthInterceptor is not a function"
What can I do ?
Thanks
When creating a react app using npx create-react-app now it comes with webpack v5, it seams that this package does not support it, when i try using it throws this error:
ERROR in ./node_modules/axios-oauth-1.0a/dist/index.js 25:31-48
Module not found: Error: Can't resolve 'crypto' in '/Users/jsuazo/Code/test/my_ap/node_modules/axios-oauth-1.0a/dist'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
There were some issues with installing dependencies, but once removed all axios versions up the dependency tree it did install but not cleanly 2 high severity warnings. Will they be addressed at some stage for easy/ secure automated installs? Thanks
The 0.2.2 release is broken -- no dist
directory in npm. if you could fix it we'd really appreciate it =]
Services like Twitter need oauth_callback and oauth_version headers.
I couldn't find the documentation to use it with this package.
Any pointers?
After adding resolve.fallback, I am receiving the following error:
Uncaught (in promise) ReferenceError: Buffer is not defined at calculateBodyHash
which looks to be referencing line 19 in index.ts
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.