Comments (3)
The invocation order was the problem. I needed to reorganize my code to ensure initializePushNotifications() was fired within my AuthenticationGateway component.
You can feel free to close. Thank you.
from amplify-js.
Possible source of issue:
It seems initializePushNotifications() is ultimately calling await fetchAuthSession() from @aws-amplify/core. This call is failing as no user's are currently logged in. I am using the Amplify UI Authenticator for React Native, which is loaded to log the user in AFTER initializePushNotifications() has already been called....
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';
import { Amplify } from 'aws-amplify';
import { initializePushNotifications } from 'aws-amplify/push-notifications';
import amplifyconfig from './src/amplifyconfiguration.json';
Amplify.configure(amplifyconfig);
initializePushNotifications();
AppRegistry.registerComponent(appName, () => App);
My configuration is similar (App.js).
import React from 'react';
// AWS
import {Authenticator} from '@aws-amplify/ui-react-native';
import {Amplify} from 'aws-amplify';
import {initializePushNotifications} from 'aws-amplify/push-notifications';
// Components
import AuthenticationGateway from './src/components/AuthenticationGateway/AuthenticationGateway';
// SplashScreen
import * as SplashScreen from 'expo-splash-screen';
SplashScreen.preventAutoHideAsync();
setTimeout(SplashScreen.hideAsync, 5000);
Amplify.configure({
Auth: {
Cognito: {
// Amazon Cognito User Pool ID
userPoolId: 'XXXX',
// OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string)
userPoolClientId: 'XXXX',
// REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID
identityPoolId: 'XXXX',
},
},
Notifications: {
PushNotification: {
Pinpoint: {
appId: 'XXXX',
region: 'us-west-2',
},
},
},
Analytics: {
Pinpoint: {
appId: 'XXXX',
region: 'us-west-2',
},
},
});
initializePushNotifications();
function App() {
return (
<Authenticator.Provider>
<AuthenticationGateway />
</Authenticator.Provider>
);
}
export default App;
from amplify-js.
Hello, @SwhiteMHC and thanks for opening this issue. To your point that initializePushNotifications()
calls fetchAuthSession()
under the hood, can you confirm if you have guest access (i.e. unauth roles) enabled for you app?
from amplify-js.
Related Issues (20)
- `fetchUserAttributes` to accept a generic of the known attribute structure HOT 2
- In `fetchAuthSession()`, `token` and `subs` are undefined, whereas in Amplify version 5, they are available. HOT 3
- Allow to use `confirmUserAttribute` without active session HOT 3
- Update use case 4 in amazon-cognito-identity-js to use AWS SDK for JavaScript (v3) HOT 1
- Having problems when signing in using withAuthenticator and problems using { Auth } from 'aws-amplify' when not - why is this? HOT 2
- Amplify/auth - Get current cognito user device HOT 3
- signInWithRedirect - social login using Google not working. HOT 4
- Received an UnauthorizedException when calling GraphQL with Auth0 as OIDC. HOT 1
- getDnsSuffix Webpack Error On Build HOT 7
- onNotificationReceivedInForeground from aws-amplify/push-notifications is not triggered HOT 8
- multi page react web app .jpg and .ttf files not rendering on amplify HOT 2
- [Amplify Admin Actions] CORS error and unable to pass queryStringParameters HOT 3
- Angular v17 and latest typescript having issues with @aws-amplify sub-dependencies HOT 2
- Not able to login after upgrading to v6 from v4 HOT 2
- DataStore. Disable sync for model in SyncExpressions
- SerializationException: Start of structure or map found where not expected HOT 1
- custom domain add error - One or more of the CNAMEs you provided are already associated with a different resource
- ObserveQuery / OnUpdate not respecting selection set nested models - returns function instead HOT 4
- Datastore returning old version on app startup and then shortly updating
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-js.