react-ketting
Version:
Ketting bindings for React
52 lines (51 loc) • 1.35 kB
TypeScript
import * as React from 'react';
declare type Props = {
/**
* OAuth2 Client ID
*/
clientId: string;
/**
* OAuth2 authorize endpoint.
*
* For example https://my-server/authorize
*/
authorizeEndpoint: string;
/**
* OAuth2 token endpoint
*
* For example: https://my-server/token
*/
tokenEndpoint: string;
/**
* If passed, this component will render while authentication is not yet
* complete.
*/
authenticatingComponent?: React.ReactNode;
/**
* Child components. Will only be rendered after authentication is complete
*/
children: React.ReactNode;
/**
* Callback
*
* Will be triggered when authentication is successful
*/
onSuccess: (state: string | null) => void;
/**
* After the authentication process is complete, this component will make 1
* GET request to test if it actually worked.
*
* By default it will use the Ketting bookmark url, but this can be overridden
* here.
*
* If it's set to "null", this test is skipped.
*/
testEndpoint?: string;
};
/**
* The RequireLogin component ensures that a user is authenticated.
*
* Children will not be rendered until this is the case.
*/
declare const RequireLogin: React.FC<Props>;
export { RequireLogin };