![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@globus/react-auth-context
Advanced tools
A React context for integrating Globus Auth into your application using the Globus JavaScript SDK
@globus/react-auth-context
A simple React context for managing Globus-related authentication state, built on top of the @globus/sdk.
npm install --save @globus/sdk @globus/react-auth-context
The package includes a <Provider>
that can be configured with a client
, scopes
, and redirect
that will be used to configure an AuthorizationManager
instance for the context. The useGlobusAuth
hook can be used to access the authentication state and the AuthorizationManager
instance.
import React, { useEffect } from "react";
import { Provider, useGlobusAuth } from '@globus/react-auth-context';
/**
* Your registered Globus Client ID.
*/
const client = '645b6bfb-4195-4010-83f5-a71332bd4761';
/**
* Scopes required for your application on login.
*/
const scopes = 'urn:globus:auth:scope:transfer.api.globus.org:all';
/**
* Redirect URL that will complete the OAuth2 flow, this will also be the location you call `.handleCodeRedirect` from.
*/
const redirect = '/';
const App = () => (
/**
* The `Provider` component wraps the application and provides the authentication context.
*/
<Provider client={client} scopes={scopes} redirect={redirect}>
<ExampleComponent />
</Provider>
);
const ExampleComponent = () => {
/**
* The `useGlobusAuth` hook provides access to the authentication state and the `AuthorizationManager` instance.
*/
const { isAuthenticated, authorization } = useGlobusAuth();
useEffect(() => {
async function attempt() {
if (!authorization || isAuthenticated) {
return;
}
await instance?.handleCodeRedirect({
shouldReplace: false,
});
}
attempt();
}, [authorization, authorization?.handleCodeRedirect, isAuthenticated]);
return (
<div>
{isAuthenticated ? (
<button onClick={async () => await auth.authorization?.revoke()}>Logout</button>
) : (
<button onClick={async () => await auth.authorization?.login()}>Login</button>
)}
</div>
);
};
FAQs
A React context for integrating Globus Auth into your application using the Globus JavaScript SDK
We found that @globus/react-auth-context demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.