Closed alexung closed 3 years ago
Hi @alexung sorry to hear you are having issues retrieving the oauth
data you once had in your aws-exports.js
file. It indeed can be problematic since it is usually git ignored
.
Have you tried running amplify pull
from the root of your project directory? I just opened one of my sample apps locally, deleted the aws-exports.js
contents, ran that command, and it pulled in the original data.
If that doesn't work, something else is likely happening with your oauth
configuration. But let us know if the amplify pull
command does the trick, and if not we can go back to the drawing board together!
Closing this issue for now as we have not heard back from you. Please feel free to re-open this if you are still in need of assistance. Thank you!
Hi! I am getting the same error, and was wondering if you were ever able to reproduce it.
Similar to Op, my oauth is empty in aws-exports.js and I know it shouldn't be. When I amplify pull, it does not bring the data back in.
Unlike op, I can fix it manually because I have copy/pasted the correct aws-exports before, so had it handy.
If I manually change aws-exports.js to the correct config as below it works flawlessly, but amplify pulling resets the file to the incorrect config. (***** used in place of app-specific keys)
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten. const awsmobile = { aws_project_region: 'us-west-2', aws_cognito_identity_pool_id: 'us-west-2:', aws_cognito_region: 'us-west-2', aws_user_poolsid: 'us-west-2', aws_user_pools_web_client_id: '', oauth: { domain: '.auth.us-west-2.amazoncognito.com', scope: ['aws.cognito.signin.user.admin', 'email', 'openid', 'phone', 'profile'], redirectSignIn: 'exp://127.0.0.1:19000/', redirectSignOut: 'exp://127.0.0.1:19000/', responseType: 'code', }, federationTarget: 'COGNITO_USER_POOLS', aws_appsync_graphqlEndpoint: 'https://*****.appsync-api.us-west-2.amazonaws.com/graphql', aws_appsync_region: 'us-west-2', aws_appsync_authenticationType: 'API_KEY', aws_appsync_apiKey: '*****', }; export default awsmobile;
The following is the incorrect config that is produced from an amplify pull.
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = { "aws_project_region": "us-west-2", "aws_cognito_identity_pool_id": "us-west-2:", "aws_cognito_region": "us-west-2", "aws_user_poolsid": "us-west-2", "aws_user_pools_web_client_id": "", "oauth": {}, "aws_appsync_graphqlEndpoint": "https://.appsync-api.us-west-2.amazonaws.com/graphql", "aws_appsync_region": "us-west-2", "aws_appsync_authenticationType": "API_KEY", "aws_appsync_apiKey": "*****" };
export default awsmobile;
Since we amplify env checkout and amplify pull to switch branches all the time, this is a huge pain in the neck and I would love to know how to fix it. Any help would be amazing!
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels or Discussions for those types of questions.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
Users when clicking the oauth button, e.g. below...
...are getting
TypeError: undefined is not an object (evaluating 'this._oAuthHandler.oauthSignIn')
.What's strange is that In
aws-exports.js
theoauth
object is empty. Not sure exactly why, given that this file is git-ignored and for the past year I've been usingfederatedSignIn
with google/apple?:I think what had happened is that my
aws-exports.js
, on someamplify push
removed alloauth
data. Given that this file is git-ignored, I'm unable to get it back. Do you all know how to retrieve this information again, given that I haven't made any changes in the aws console?Thank you for your help.
Expected behavior
federatedSignIn
buttonReproduction steps
With amplify of any minor/patch version in v3.3.x:
federatedSignIn
buttonTypeError: undefined is not an object (evaluating 'this._oAuthHandler.oauthSignIn')
Code Snippet
Log output
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