Skip to content

bug: getAccessToken function causes infinite re-renders when used as shown in documentation #282

@TharakaUJ

Description

@TharakaUJ

Description

When using the useGetAccessToken hook exactly as in documentation, the component re-renders continuously.

This makes the documented usage pattern unusable in real applications.

Expected behavior: The access token should be retrievable without causing a render loop.

Actual behavior: The component keeps re-rendering indefinitely.

Steps to Reproduce

Create a new React component authenticated with Asgardeo.

Use the getAccessToken function from useAsgardeo hook inside a useEffect as shown in below:

const { isSignedIn, getAccessToken } = useAsgardeo();

useEffect(() => {
    getAccessToken().then((token) => {
        console.log(token);
    });
}, [ getAccessToken ]);

Run the app.

Observe continuous re-renders and repeated logging of the token.

or use the snippet given in the documentation.

Please select the area the issue is related to

@asgardeo/react

Version

0.6.16

Environment Details (with versions)

"react": "^19.2.0",

Reporter Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided all the necessary information.
  • I have tested the issue on the latest version of the package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions