
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.
@crossid/crossid-spa-js
Advanced tools
Crossid is an OAuth2 / OIDC client for single page application (SPA) with support for PKCE extension.
OAuth2 and OIDC SDK for a single page application (SPA), using the authorization code flow with PKCE extension.
Install by:
npm:
npm install @crossid/crossid-spa-js
yarn:
yarn add @crossid/crossid-spa-js
Init a client:
import { newCrossidClient, Client } from '@crossid/crossid-spa-js'
const crossid = newCrossidClient({
// your crossid tenant
tenant_id: 'indexia',
client_id: 'my-client-id',
audience: ['example.com'],
scope: 'openid profile',
redirect_uri: 'http://localhost:3009',
// use session_storage or local_storage for a persistent cache.
cache_type: 'memory',
})
note: the example above shows how to connect to a crossid tenant but this library can work with any OIDC authorization server that supports the PKCE extension. See newCrossidClientByDiscovery and newCrossidClientCustom.
To sign user in, call crossid.loginWithRedirect({})
to redirect browser to the authprization server login page.
This function is typically bound to a button.
Once signing the user in completes successfully, the user will be redirected to the location specified in redirect_uri
.
At this point, the signing in process must be completed by running the crossid.handleRedirectCallback()
function which will take care of completing the flow and caching the tokens.
To get an access token, which can be used to access your API:
const token = await client.getAccessToken()
To get the authenticated user:
const user = await client.getUser()
For a working example, see example repo.
Have a bug, feature request or feedback? Please first search for existing and closed issues. If your problem or idea is not addressed yet, please open a new issue.
The main purpose of this repository is to continue evolving crossid-spa-js, making it more secure and easier to use. Development of this library happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving crossid-spa-js.
The Crossid team takes security issues very seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
To report a security issue, email security@crossid.io.
We'll endeavor to respond quickly, and will keep you updated throughout the process.
Crossid can:
This project is licensed under the MIT license.
FAQs
Crossid is an OAuth2 / OIDC client for single page application (SPA) with support for PKCE extension.
The npm package @crossid/crossid-spa-js receives a total of 4 weekly downloads. As such, @crossid/crossid-spa-js popularity was classified as not popular.
We found that @crossid/crossid-spa-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
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.