fc-oidc-provider
v1.0.6
Published
[![Stable Release](https://img.shields.io/npm/v/fc-oidc-provider.svg)](https://npm.im/fc-oidc-provider)
Downloads
159
Readme
fc-oidc-provider
该库为蜂巢基于浏览器的 React 客户端应用程序提供 FCID 认证支持。还包括对用户会话和访问令牌管理的支持。
安装
Using npm
$ npm install fc-oidc-provider --save
使用
FcAuthProvider
import * as React from "react";
import { FcAuthProvider } from "fc-oidc-provider";
const oidcConfiguration = {
//authority: "https://<host>/realms/<application realms>",
client_id: "<client id>",
redirect_uri: "<redirect_uri>",
};
function App() {
return (
<FcAuthProvider config={oidcConfiguration}>
<ApplicationComponent />
</FcAuthProvider>
);
}
export default App;
SSO 登录
import React, { useEffect } from "react";
import { useFcAuth } from "fc-oidc-provider";
function Login() {
const { signIn } = useFcAuth();
useEffect(() => {
signIn();
}, []);
return <div>Login...</div>;
}
export default Login;
License
This project is licensed under the Apache-2.0 license. See the LICENSE file for more info.