Created
July 27, 2020 18:55
-
-
Save KevinDanikowski/58a24be0e3067e545c4d6a85dcc94194 to your computer and use it in GitHub Desktop.
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
import getConfig from 'next/config' | |
import { UserProvider, initUser } from '../lib/UserContext' | |
import Amplify from '@aws-amplify/core' | |
import Auth from '@aws-amplify/auth' | |
const { | |
publicRuntimeConfig: { aws, appEnv }, | |
} = getConfig() | |
Amplify.configure({ | |
Auth: { | |
region: aws.region, | |
userPoolId: aws.userPoolId, | |
userPoolWebClientId: aws.userPoolWebClientId, | |
}, | |
}) | |
Auth.configure({ | |
oauth: { | |
domain: aws.idpDomain, | |
// must have these checked on the cognito AWS console, profile is necessary to get user data | |
scope: ['email', 'openid', 'profile'], | |
redirectSignIn: aws.redirectSignIn, | |
redirectSignOut: aws.redirectSignOut, | |
responseType: 'token', | |
}, | |
}) | |
class MyApp extends App { | |
... | |
render() { | |
const { Component, pageProps } = this.props | |
return ( | |
<UserProvider value={initUser}> | |
<Component {...pageProps} /> | |
</UserProvider> | |
) | |
} | |
} | |
export default withApollo(MyApp) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment