https://serverless-stack.com/ logo
#help
Title
# help
e

Ernie Francis

02/17/2022, 7:58 PM
Do we have a example of a stack with auth and AWS Amplify?
d

Devin

02/17/2022, 8:00 PM
What part of amplify? deployment or just the library for front end calls?
e

Ernie Francis

02/17/2022, 8:00 PM
front end calls, like from expo or react/next.js
Copy code
// Configure AWS Amplify
Amplify.configure({
  ...awsconfig,
  oauth: {
    ...awsconfig.oauth,
    urlOpener,
    redirectSignIn: createURL('/'),
    redirectSignOut: createURL('/'),
  },
});
i used amplify to scaffold the auth service, but i want to use SST since amplify is too code-gen like.
d

Devin

02/17/2022, 8:02 PM
oh word. The tutorial handles that pretty well. However, I can provide a sample code snippet or two if you need it. First check out these two chapters https://serverless-stack.com/chapters/adding-auth-to-our-serverless-app.html https://serverless-stack.com/chapters/configure-aws-amplify.html
But basically I have this as my config
Copy code
Amplify.configure({
  API: {
    endpoints: [
      {
        name: "customers",
        endpoint: config.apiGateway.URL,
        region: config.apiGateway.REGION,
      },
    ],
  },
  Auth: {
    mandatorySignIn: true,
    region: config.cognito.REGION,
    userPoolId: config.cognito.USER_POOL_ID,
    identityPoolId: config.cognito.IDENTITY_POOL_ID,
    userPoolWebClientId: config.cognito.APP_CLIENT_ID,
  },
  Storage: {
    region: config.s3.REGION,
    bucket: config.s3.BUCKET,
  },
});
e

Ernie Francis

02/17/2022, 8:05 PM
kind of helps, do we have a github repo for the amplify chapter?
NVM, found it
does the sst package include a preset for expo or react native? similar to
Copy code
// Create a Next.js site
    const site = new sst.NextjsSite(this, "Site", {
      path: "frontend",
      environment: {
        // Pass the table details to our app
        REGION: scope.region,
        TABLE_NAME: table.tableName,
      },
    });
like is there a
Copy code
new sst.Expo(...)?
d

Devin

02/17/2022, 8:21 PM