
Security News
Socket Integrates With Bun 1.3’s Security Scanner API
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
@webex/plugin-authorization
Advanced tools
This package automatically loads the appropriate environment-specific authorization plugin for the Webex SDK.
npm install --save @webex/plugin-authorization
The @webex/plugin-authorization
package serves as a universal entry point that automatically selects and loads the correct authorization implementation based on your environment:
@webex/plugin-authorization-browser
for client-side applications@webex/plugin-authorization-node
for server-side applicationsThis allows you to use a single import while getting the optimal authorization implementation for your runtime environment.
This is a plugin for the Cisco Webex JS SDK. Please see our developer portal and the API docs for full details.
const Webex = require('webex');
const webex = Webex.init({
credentials: {
client_id: 'your-client-id',
client_secret: 'your-client-secret', // Only for Node.js environments
redirect_uri: 'https://your-app.com/callback' // Only for browser environments
}
});
// The authorization methods available depend on your environment:
// In Node.js environments:
webex.authorization.requestAuthorizationCodeGrant({
code: 'authorization-code'
});
webex.authorization.requestAccessTokenFromJwt({
jwt: 'your-jwt-token'
});
// In browser environments:
webex.authorization.initiateLogin();
webex.authorization.initiateImplicitGrant();
The package uses the following logic to determine which implementation to load:
The Webex SDK supports different OAuth flows based on the clientType
you configure. This determines how your application authenticates with Webex:
clientType: 'confidential'
(Authorization Code Grant)initiateAuthorizationCodeGrant()
and uses response_type=code
.clientType: 'public'
(Implicit Grant)initiateImplicitGrant()
and uses response_type=token
.client_credentials
(Client Credentials Grant)getClientToken()
.Note: Only
'confidential'
and'public'
are meaningful for browser SDK.client_credentials
is only supported in Node.js/server SDKs.
The methods available through this plugin depend on your runtime environment:
initiateLogin(options)
- Start the login process. Automatically chooses the correct flow based on clientType
:
clientType: 'confidential'
, uses Authorization Code Grant (initiateAuthorizationCodeGrant
)initiateImplicitGrant
)initiateImplicitGrant(options)
- Begin implicit grant flow (redirects with response_type=token
)initiateAuthorizationCodeGrant(options)
- Begin authorization code flow (redirects with response_type=code
)requestAccessTokenFromJwt({ jwt })
- Authenticate using JWTcreateJwt(options)
- Create JWT tokenslogout(options)
- Log out the userinitiateAuthorizationCodeGrant
and initiateImplicitGrant
Method | OAuth Flow | response_type | Token Delivery | Requires Client Secret | Use Case |
---|---|---|---|---|---|
initiateAuthorizationCodeGrant | Authorization Code Grant | code | Code in URL, exchange | Yes | Backend web apps |
initiateImplicitGrant | Implicit Grant | token | Token in URL hash | No | SPAs, browser-only apps |
See Browser OAuth Flow Guide for more details.
requestAuthorizationCodeGrant(options)
- Exchange authorization code for tokenrequestAccessTokenFromJwt({ jwt })
- Authenticate using JWTgetClientToken(options)
- Obtain a client token using client_credentials grantcreateJwt(options)
- Create JWT tokenslogout(options)
- Log out the userisAuthorizing
- Boolean indicating if authorization is in progressisAuthenticating
- Alias for isAuthorizing@webex/plugin-authorization-browser
- Browser-specific implementation@webex/plugin-authorization-node
- Node.js-specific implementationFor detailed documentation on environment-specific features, please refer to the individual package documentation.
See Node OAuth Flow Guide for Node.js-specific flows.
See Browser OAuth Flow Guide for browser-specific flows.
This package is maintained by Cisco Webex for Developers.
Pull requests welcome. Please see CONTRIBUTING.md for more details.
© 2016-2025 Cisco and/or its affiliates. All Rights Reserved.
FAQs
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
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.
Security News
A data handling bug in OSV.dev caused disputed CVEs to disappear from vulnerability feeds until a recent fix restored over 500 advisories.