fix(nextjs): fix getAccessToken imperative usage #106
Merged
brionmario merged 9 commits intoasgardeo:mainfrom Jul 14, 2025
Merged
fix(nextjs): fix getAccessToken imperative usage #106brionmario merged 9 commits intoasgardeo:mainfrom
getAccessToken imperative usage #106brionmario merged 9 commits intoasgardeo:mainfrom
Conversation
…e and improved exports
…al storage parameter and add logging for initialization success and failure
… getDecodedIdToken and improve access token retrieval
…cess and export it
getAccessToken imperative usage
DonOmalVindula
approved these changes
Jul 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces several enhancements and refactorings across multiple files in the project. Key changes include adding optional storage support in client initialization, refactoring the logging system to use string-based log levels, updating the build configuration for better modularity, and improving error handling and logging in the Next.js client.
Enhancements to client initialization:
initializemethod inAsgardeoJavaScriptClientandAsgardeoNextClientto accept an optionalStorageparameter for better data persistence. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-1de99ccf9a6555feff096d35ba4d4626b4d42ce6da23d9b9ed996bb3f65e1bcbL37-R38),[[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-47d1628f385e7a95ba078012412f6b43a3af85373b276c74b1a7f620f89d8581R91-R94),[[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL102-R103),[[4]](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL140-R144))Refactoring of logging system:
LogLevelenum with string-based log levels ('debug','info','warn','error') for simplicity and consistency. ([packages/javascript/src/utils/logger.tsL22-R22](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL22-R22))Loggermethods and configuration to use the new string-based format. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL52-R46),[[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL143-R143),[[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL178-R181),[[4]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL251-R254),[[5]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL275-R278),[[6]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL300-R303),[[7]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL321-R336),[[8]](https://github.com/asgardeo/javascript/pull/106/files#diff-8c0580270723ba98f52004e79ac695085c608ca8692324a77946db5f899b431cL414-R408))Build configuration updates:
[[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-9b3cb413bdb66a14a059f23f28f0c80e103a2e9f3db9bd4b41cf0c74760d51beL23-R38),[[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442L18-R30),[[3]](https://github.com/asgardeo/javascript/pull/106/files#diff-e5237f683dda3354b835c7c7c94b9759db2c743d4ba94d47d7f8b8e0b2bfb442L39-R45))Improvements in error handling and logging:
SignOutButtonandAsgardeoClientProviderto improve traceability during sign-out operations. ([[1]](https://github.com/asgardeo/javascript/pull/106/files#diff-7d41802bc94382af01f812891286ad0a2e15bb4cb743536d3456f462d71186fbR61-R77),[[2]](https://github.com/asgardeo/javascript/pull/106/files#diff-0abb0e8335a4c28dd6a42d47ce2048fcc129577d530a5e071c2443e597fc1204R252-R277))SignOutButtonwith logger-based error reporting for better debugging. ([packages/nextjs/src/client/components/actions/SignOutButton/SignOutButton.tsxR61-R77](https://github.com/asgardeo/javascript/pull/106/files#diff-7d41802bc94382af01f812891286ad0a2e15bb4cb743536d3456f462d71186fbR61-R77))Miscellaneous updates:
getAccessTokenmethod inAsgardeoNextClientto handle session cookies and provide detailed runtime error information when token retrieval fails. ([packages/nextjs/src/AsgardeoNextClient.tsL380-R410](https://github.com/asgardeo/javascript/pull/106/files#diff-6dd1988c5d19f9da1aad558bd53b5424d32b61a9e3a26456e3db82aa18cc384cL380-R410))Related Issues
@asgardeo/react&@asgardeo/nextjs#81Related PRs
Checklist
Security checks