
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
@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.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.