
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
NOTE coauth client scripts use JSON object, so provide a polyfill if you need it for old browsers.
If you want to perform last step by yourself (to customise it or whatever), you can set options.customAuthResultRequest = true
then instead of the last step the following will happen:
The same as auth, but tries to do all the things within hidden iframe.
Works only if external service can authenticate a user without interaction (redirects back instantly). Otherwise will fail on timeout.
Resource creation provided by ResourceCreator class.
Generates external system auth url.
Use createAuthUrlResource() method.
Exchanges data obtained after redirection to auth url with auth result.
Use createAuthResultResource() method.
For test purposes only. Exposes coauth client script.
Use createJsResource() method .
var auth = new coauth.Auth(url);
var options = {
providerType: 'fb',
authPageUrl: '/heading/to/external/system/page',
resultPageUrl: 'http://example.com/comming/back/page'
};
var authWorker = auth.auth(options, function(err, result) {
if(err) {
console.log('err', err);
} else {
console.log('result', result);
// if options.customAuthResultRequest == true
// call your result resource providing 'result' parameter,
// on complete call:
// authWorker.closeWindow();
}
});
Required options are:
{
providerType: '', // provider type
identity: null, // your identity if need
hidden: false, // if true, make auth() work exactly as tryAuth(), has no effect for tryAuth()
authPageUrl: '', // stub page to show before redirection to external system, must contain appropriate sript (see page_examples dir)
resultPageUrl: '', // stub page to show on redirection from external system, must contain appropriate sript (see page_examples dir) and must be full url (because will be used as redirect URI)
customAuthResultRequest: false, // set to true if want to request result resource by yourself
postMessageWorkaroundFuncName: '', // what function to call on opened window if postMessage() doesn't work
tryAuthTimeout: 5000, // timeout for tryAuth(), null - use default, 0 - no timeout
window: {
features: 'dialog=true', // features of popup window
closeCheckInterval: 200 // how often to check if window is closed by user, ms
},
auth: { // provider-specific auth step options
scope: [] // permissions requested
// other provider-specific options
},
result: { // provider-specific result obtaining step options
fields: [] // fields requested
// other provider-specific options
}
}
All server response objects have following properties:
For standard flow, see Validation.AuthResult
For customAuthResultRequest == true result contains at least following:
Error is an Error with following possible properties:
coauth errors:
Noauth/provider errors:
Other errors are unlikely, but still can be raised.
MIT
FAQs
OAuth client for apis using noauth
The npm package coauth receives a total of 2 weekly downloads. As such, coauth popularity was classified as not popular.
We found that coauth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.