drupal-react-oauth-provider
Version:
Drupal React Oauth Provider and Hooks for REST / JSONAPI etc.
38 lines (37 loc) • 1.1 kB
TypeScript
import React from 'react';
export interface Token {
date: number;
access_token: string;
refresh_token: string;
expires_in: number;
token_type: string;
expirationDate: number;
}
export interface OauthSettings {
url: string;
_clientID: string;
_clientSecret: string;
_grantType: string;
_scope: string;
}
export interface OauthSettingsProxy {
proxyURL: string;
}
interface ProviderConfig {
url: string;
token?: Token | null;
handleSetToken?: (token: Token) => void;
_isAuthenticated?: boolean;
getHeaders?: () => Headers;
addHeaders?: (key: string, value: string) => void;
removeHeaders?: (key: string) => void;
storeOauthSettings?: (settings: OauthSettings | OauthSettingsProxy) => void;
logoutUser?: () => void;
}
interface ProviderProps {
readonly children: React.ReactNode;
config: ProviderConfig;
}
export declare const DrupalContext: React.Context<ProviderConfig>;
export declare const DrupalProvider: ({ children, config }: ProviderProps) => JSX.Element;
export {};