Description
Before opening, please confirm:
- I have searched for duplicate or closed issues and discussions.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
Not applicable
Environment information
# Put output below this line
"@aws-amplify/api": "^4.0.14",
"@aws-amplify/auth": "^4.3.4",
"@aws-amplify/core": "^4.2.8",
"react-native": "0.64.2"
Describe the bug
When using Auth0OAuthOpts rather than AwsCognitoOAuthOpts (shown below), an unhandled promise rejection error occurred.
Referenced:
https://github.com/aws-amplify/amplify-js/blob/main/packages/auth/src/types/Auth.ts#L131
export interface AwsCognitoOAuthOpts {
domain: string;
scope: Array;
redirectSignIn: string;
redirectSignOut: string;
responseType: string;
options?: object;
urlOpener?: (url: string, redirectUrl: string) => Promise;
}export function isCognitoHostedOpts(
oauth: OAuthOpts
): oauth is AwsCognitoOAuthOpts {
return (oauth).redirectSignIn !== undefined;
}export interface Auth0OAuthOpts {
domain: string;
clientID: string;
scope: string;
redirectUri: string;
audience: string;
responseType: string;
returnTo: string;
urlOpener?: (url: string, redirectUrl: string) => Promise;
}export type OAuthOpts = AwsCognitoOAuthOpts | Auth0OAuthOpts;
Expected behavior
Using Auth0OAuthOpts should behave the same as AwsCognitoOAuthOpts, such as opening the WebUI.
Reproduction steps
- Use below Amplify OAuth Config:
oauth: {
domain: auth0_domain,
clientID: auth0_client_id,
scope: 'email openid',
redirectUri: auth0CallbackUri,
responseType: 'code',
returnTo: auth0CallbackUri,},
- Call the below API
Auth.federatedSignIn({customProvider: 'auth0'})
- An Unhandled Promise Rejection error occurred
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
WARN Possible Unhandled Promise Rejection (id: 0):
TypeError: Cannot read property 'oauthSignIn' of undefined
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response