diff --git a/package.json b/package.json index a62e139..f4b1c7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@easyauth.io/easyauth-react", - "version": "1.0.2", + "version": "1.0.3", "description": "React SDK for EasyAuth", "main": "dist/index.js", "module": "dist/index.es.js", diff --git a/src/components/SignOutButton/SignOutButton.jsx b/src/components/SignOutButton/SignOutButton.jsx new file mode 100644 index 0000000..c52ed00 --- /dev/null +++ b/src/components/SignOutButton/SignOutButton.jsx @@ -0,0 +1,27 @@ +import {useEasyauth} from '../../hooks/useEasyauth/useEasyauth.jsx'; +import PropTypes from 'prop-types'; +import React from 'react'; + +export const SignOutButton = ({callback, children}) => { + const auth = useEasyauth(); + const logoutLink = + auth.settings.authority.substring(0, auth.settings.authority.lastIndexOf('/')) + + '/logout?target=' + + btoa(callback || window.location.href); + + return ( +