Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@globalfishingwatch/api-client
Advanced tools
js library to help with the login/logout and resources fetch of the GFW API
Simply pure js library to help on the GFW API with:
yarn
yarn add @globalfishingwatch/api-client
npm
npm i @globalfishingwatch/api-client --save
There are two options to initialize the library:
The simplest way, just include the basic config in the .env
when no extra configuration is needed.
API_AUTH_URL=https://gateway.api.dev.globalfishingwatch.org
import GFWAPI from 'gfw-api-client'
// use where needed
The library will use by default the tokens stored in the localStorage to keep it as simple as possible, if you need to use your own config use the option 2.
Create your own class instance using the configuration params, when extra configuration is needed.
Example:
import { GFW_API } from 'gfw-api-client'
const GFWAPI = new GFW_API({
baseUrl: 'https://gateway.api...',
token: 'your_token',
tokenStorageKey: 'MY_KEY...'
debug: true|false
})
access-token
to generate the session token
and the refreshToken
but it won't be useful anymore.try {
const user = await GFWAPI.login({ accessToken: 'acces_token_here' })
console.log(user) // returns user data
} catch(e) {
console.warn('Something happened on the login', e)
}
refreshToken
:try {
const user = await GFWAPI.login({ refreshToken: 'refresh_token_here' })
console.log(user) // returns user data
} catch(e) {
console.warn('Something happened on the login', e)
}
try {
const user = await GFWAPI.login()
console.log(user) // returns user data
} catch(e) {
console.warn('Something happened on the login', e)
}
try {
const data = await GFWAPI.fetch('your_url_here')
console.log(data) // returns the desired data
} catch(e) {
console.warn('Something happened on the gfw api fetch', e)
}
token
and refreshToken
just use:try {
const logged = await GFWAPI.logout()
console.log(logged) // returns true when logout was good
} catch(e) {
console.warn('Something happened on the logout', e)
}
Just use:
GFWAPI.getToken()
// or
GFWAPI.getRefreshToken()
Use your own instance of the API client including this param:
const GFWAPI = new GFW_API({
....
debug: true
})
FAQs
Unknown package
The npm package @globalfishingwatch/api-client receives a total of 28 weekly downloads. As such, @globalfishingwatch/api-client popularity was classified as not popular.
We found that @globalfishingwatch/api-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.