-
Notifications
You must be signed in to change notification settings - Fork 229
fix: resolve circular dependency in Auth0Provider #1341
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
Open
AlexandreLage
wants to merge
10
commits into
auth0:master
Choose a base branch
from
AlexandreLage:fix/circular-dependency-auth0provider
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9d5c994
fix: resolve circular dependency in Auth0Provider
alex-at-sagelabs 66d926a
feat: move Auth0 class; finalize scope as beta.3; update provider in…
alex-at-sagelabs ff8a3eb
fix: finalize scope in authentication flows; adjust eslint directive …
alex-at-sagelabs cda9609
fix: simplify client initialization in Auth0Provider
alex-at-sagelabs 391591d
fix: format client initialization in Auth0Provider for consistency
alex-at-sagelabs 757cf54
fix: remove finalizeScope from authentication parameters to use raw s…
alex-at-sagelabs 014dcf4
Fix: Export pattern for conversion utilities
alex-at-sagelabs 7b25229
fix: inline snakeToCamel function in Auth0User and export utility fun…
alex-at-sagelabs f0cafe0
Update src/core/models/Auth0User.ts
AlexandreLage 1b628a8
refactor: move snakeToCamel function to stringUtils and update imports
alex-at-sagelabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import type { IAuth0Client } from './core/interfaces/IAuth0Client'; | ||
import { Auth0ClientFactory } from './factory/Auth0ClientFactory'; | ||
import type { Auth0Options } from './types'; | ||
|
||
/** | ||
* The main Auth0 client class. | ||
* | ||
* This class acts as a facade, creating and delegating to a platform-specific | ||
* client instance (Native or Web) under the hood. | ||
* | ||
* @example | ||
* ``` | ||
* import Auth0 from 'react-native-auth0'; | ||
* | ||
* const auth0 = new Auth0({ | ||
* domain: 'YOUR_AUTH0_DOMAIN', | ||
* clientId: 'YOUR_AUTH0_CLIENT_ID' | ||
* }); | ||
* ``` | ||
*/ | ||
export class Auth0 { | ||
private client: IAuth0Client; | ||
|
||
/** | ||
* Creates an instance of the Auth0 client. | ||
* @param options Configuration options for the client. | ||
*/ | ||
constructor(options: Auth0Options) { | ||
// The factory detects the platform and returns the appropriate client implementation. | ||
// The rest of this class is completely unaware of whether it's running on native or web. | ||
this.client = Auth0ClientFactory.createClient(options); | ||
} | ||
|
||
/** | ||
* Provides access to the web-based authentication methods. | ||
* @see IWebAuthProvider | ||
*/ | ||
get webAuth() { | ||
return this.client.webAuth; | ||
} | ||
|
||
/** | ||
* Provides access to the credentials management methods. | ||
* @see ICredentialsManager | ||
*/ | ||
get credentialsManager() { | ||
return this.client.credentialsManager; | ||
} | ||
|
||
/** | ||
* Provides access to direct authentication methods (e.g., password-realm). | ||
* @see IAuthenticationProvider | ||
*/ | ||
get auth() { | ||
return this.client.auth; | ||
} | ||
|
||
/** | ||
* Provides access to the Management API (e.g., for user patching). | ||
*/ | ||
users(token: string) { | ||
return this.client.users(token); | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Pure string utility functions with no external dependencies. | ||
* This avoids circular dependencies with models. | ||
*/ | ||
|
||
/** | ||
* A helper that converts a single snake_case or kebab-case string to camelCase. | ||
* e.g., 'user_profile' -> 'userProfile' | ||
*/ | ||
export function snakeToCamel(str: string): string { | ||
var parts = str.split('_').filter((part) => part.length > 0); | ||
if (parts.length === 0) return ''; | ||
|
||
return parts.reduce(function (p, c, index) { | ||
if (index === 0) { | ||
return c.charAt(0).toLowerCase() + c.slice(1); | ||
} | ||
return p + c.charAt(0).toUpperCase() + c.slice(1); | ||
}, ''); | ||
} |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.