Closed Jordan-Nelson closed 4 months ago
Hey @Jordan-Nelson :wave: thanks for raising this! Marking as a bug
This doesn't appear to be fully resolved. The oAuth section is now present, but it is missing the user pool client id. Also the socialProviders section (oauth.identity_providers in gen2) is missing.
Just to clarify the first step
Create a backend with a non-gen-2 auth backend that uses oAuth (see example below)
But the example uses import { defineBackend } from "@aws-amplify/backend";
which is Gen2. Is there a typo?
Apologies for the confusion. By "non-gen-2" backend, I meant an app that is using an existing Cognito resource.
However, this issue can be reproduced with a gen 2 app as well. See the steps below.
Reproduction steps using Gen 2:
flutter create my_amplify_app
cd my_amplify_app
npm create amplify@latest -y
amplify/auth/resource.ts
with the following code:
import { defineAuth, secret } from "@aws-amplify/backend";
export const auth = defineAuth({ loginWith: { email: true, externalProviders: { google: { clientId: secret("google_client_id"), clientSecret: secret("google_client_secret"), scopes: ["email", "profile"], }, callbackUrls: ["myapp://"], logoutUrls: ["myapp://"], }, }, });
3. add the the two secrets:
- run `npx ampx sandbox secret set google_client_id` and then enter any string
- run `npx ampx sandbox secret set google_client_secret` and then enter any string
4. run `npx ampx sandbox --outputs-format dart --outputs-out-dir lib --outputs-version 0`
5. Observe the OAuth section of the config located at `lib/amplifyconfiguration.dart` does not have the AppClientId (this is preventing all customers from using Gen 2 with oAuth & Flutter)
6. Observe the Auth.Default section of the config located at `lib/amplifyconfiguration.dart` does not have the socialProviders
Thanks for the detailed reproduction @Jordan-Nelson ! I was able to reproduce the issue mostly. Only one question:
Observe the OAuth section of the config located at lib/amplifyconfiguration.dart does not have the AppClientId (this is preventing all customers from using Gen 2 with oAuth & Flutter)
Did you mean no AppClientId in amplify_outputs.dart? I do see
AppClientId
in amplifyconfiguration.dart .AppClientId
is user_pool_client_id
in amplify_outputs.dart
Closing as the last issue is resolved in PR #1655
Environment information
Description
Note: The repro steps use .addOutputs to reproduce this, but it appears to be reproducible with an app that uses
defineAuth()
to add the oauth config. See: https://github.com/aws-amplify/amplify-flutter/issues/4922Steps to reproduce:
npx ampx generate outputs --format dart --out-dir lib --outputs-version 0
)npx ampx generate outputs --format dart --out-dir lib
)Expected Behavior: oAuth is present in both gen 1 and gen 2 config formats. Actual Behavior: oAuth is missing when using the gen 1 config format.
gen 2 outputs (oAuth present)
gen 1 config (oAuth missing)