Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR (Authenticator): Ability to pass customState via Federated Auth #4805

Open
kevoj7 opened this issue Dec 3, 2023 · 3 comments
Open

FR (Authenticator): Ability to pass customState via Federated Auth #4805

kevoj7 opened this issue Dec 3, 2023 · 3 comments
Labels
Authenticator An issue or a feature-request for an Authenticator UI Component feature-request Request a new feature

Comments

@kevoj7
Copy link

kevoj7 commented Dec 3, 2023

Could you please add the option to pass a custom ouath state for the buttons clicked?

@github-actions github-actions bot added the pending-triage Issue is pending triage label Dec 3, 2023
@kevoj7
Copy link
Author

kevoj7 commented Dec 4, 2023

How can I pass the customState to the provider with Authenticator Amplify UI?

export default function AuthLogin() {
console.log("AuthLogin Client Component Rendered")

const [customState, setCustomState] = useState<AuthStateTypes>({
    authFlow: 'Signin',
    authType: 'GoogleSignin',
    userType: null
});

return (
    <div className="flex flex-col justify-center items-center min-h-screen">
        <button
            onClick={() => signInWithRedirect({
                provider: 'Google',
                customState: JSON.stringify(customState)
            })}>
            Sign in with Google
        </button>

    </div>
);

}

@reesscot reesscot added the feature-request Request a new feature label Dec 5, 2023
@reesscot
Copy link
Contributor

reesscot commented Dec 5, 2023

Hi @kevoj7,
This is not currently possible using the Authenticator UI component, you would need to use the JS signInWithRedirect API directly as you mentioned above. It's not ideal, but as a workaround you could put your button using signInWithRedirect in the customizable footer slot. See: https://ui.docs.amplify.aws/react/connected-components/authenticator/customization#headers--footers

@reesscot reesscot added the Authenticator An issue or a feature-request for an Authenticator UI Component label Dec 5, 2023
@reesscot reesscot changed the title customState for Authenticator UI FR (Authenticator): Ability to pass customState via Federated Auth Dec 5, 2023
@reesscot reesscot removed the pending-triage Issue is pending triage label Dec 6, 2023
@ioanabrooks ioanabrooks mentioned this issue Dec 11, 2023
2 tasks
@sakaal
Copy link

sakaal commented Feb 4, 2024

Indeed, would be very much needed. Specifically, <Authenticator customState="we need this">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Authenticator An issue or a feature-request for an Authenticator UI Component feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants