Giter Club home page Giter Club logo

amplify-ui-swift-authenticator's Introduction

AWS Amplify

current aws-amplify package version weekly downloads GitHub Workflow Status (with event) code coverage join discord

Reporting Bugs / Feature Requests

Open Bugs Feature Requests Closed Issues

Note aws-amplify 6 has been released. If you are looking for upgrade guidance click here

AWS Amplify is a JavaScript library for frontend and mobile developers building cloud-enabled applications

AWS Amplify provides a declarative and easy-to-use interface across different categories of cloud operations. AWS Amplify goes well with any JavaScript based frontend workflow and React Native for mobile developers.

Our default implementation works with Amazon Web Services (AWS), but AWS Amplify is designed to be open and pluggable for any custom backend or service.

Visit our documentation site to learn more about AWS Amplify. Please see the Amplify JavaScript page for information around the full list of features we support.

Features

Category AWS Provider Description
Authentication Amazon Cognito APIs and Building blocks to create Authentication experiences.
Analytics Amazon Pinpoint Collect Analytics data for your application including tracking user sessions.
REST API Amazon API Gateway Sigv4 signing and AWS auth for API Gateway and other REST endpoints.
GraphQL API AWS AppSync Interact with your GraphQL or AWS AppSync endpoint(s).
DataStore AWS AppSync Programming model for shared and distributed data, with simple online/offline synchronization.
Storage Amazon S3 Manages content in public, protected, private storage buckets.
Geo (Developer preview) Amazon Location Service Provides APIs and UI components for maps and location search for JavaScript-based web apps.
Push Notifications Amazon Pinpoint Allows you to integrate push notifications in your app with Amazon Pinpoint targeting and campaign management support.
Interactions Amazon Lex Create conversational bots powered by deep learning technologies.
PubSub AWS IoT Provides connectivity with cloud-based message-oriented middleware.
Internationalization --- A lightweight internationalization solution.
Cache --- Provides a generic LRU cache for JavaScript developers to store data with priority and expiration settings.
Predictions Various* Connect your app with machine learning services like NLP, computer vision, TTS, and more.
  • Predictions utilizes a range of Amazon's Machine Learning services, including: Amazon Comprehend, Amazon Polly, Amazon Rekognition, Amazon Textract, and Amazon Translate.

Getting Started

AWS Amplify is available as aws-amplify on npm.

To get started pick your platform from our Getting Started home page

Notice:

Amplify 6.x.x has breaking changes. Please see the breaking changes on our migration guide

Amplify 5.x.x has breaking changes. Please see the breaking changes below:

  • If you are using default exports from any Amplify package, then you will need to migrate to using named exports. For example:

    - import Amplify from 'aws-amplify';
    + import { Amplify } from 'aws-amplify'
    
    - import Analytics from '@aws-amplify/analytics';
    + import { Analytics } from '@aws-amplify/analytics';
    // or better
    + import { Analytics } from 'aws-amplify';
    
    - import Storage from '@aws-amplify/storage';
    + import { Storage } from '@aws-amplify/storage';
    // or better
    + import { Storage } from 'aws-amplify';
  • Datastore predicate syntax has changed, impacting the DataStore.query, DataStore.save, DataStore.delete, and DataStore.observe interfaces. For example:

    - await DataStore.delete(Post, (post) => post.status('eq', PostStatus.INACTIVE));
    + await DataStore.delete(Post, (post) => post.status.eq(PostStatus.INACTIVE));
    
    - await DataStore.query(Post, p => p.and( p => [p.title('eq', 'Amplify Getting Started Guide'), p.score('gt', 8)]));
    + await DataStore.query(Post, p => p.and( p => [p.title.eq('Amplify Getting Started Guide'), p.score.gt(8)]));
  • Storage.list has changed the name of the maxKeys parameter to pageSize and has a new return type that contains the results list. For example:

    - const photos = await Storage.list('photos/', { maxKeys: 100 });
    - const { key } = photos[0];
    
    + const photos = await Storage.list('photos/', { pageSize: 100 });
    + const { key } = photos.results[0];
  • Storage.put with resumable turned on has changed the key to no longer include the bucket name. For example:

    - let uploadedObjectKey;
    - Storage.put(file.name, file, {
    -   resumable: true,
    -   // Necessary to parse the bucket name out to work with the key
    -   completeCallback: (obj) => uploadedObjectKey = obj.key.substring( obj.key.indexOf("/") + 1 )
    - }
    
    + let uploadedObjectKey;
    + Storage.put(file.name, file, {
    +   resumable: true,
    +   completeCallback: (obj) => uploadedObjectKey = obj.key
    + }
  • Analytics.record no longer accepts string as input. For example:

    - Analytics.record('my example event');
    + Analytics.record({ name: 'my example event' });
  • The JS export has been removed from @aws-amplify/core in favor of exporting the functions it contained.

  • Any calls to Amplify.Auth, Amplify.Cache, and Amplify.ServiceWorker are no longer supported. Instead, your code should use the named exports. For example:

    - import { Amplify } from 'aws-amplify';
    - Amplify.configure(...);
    - // ...
    - Amplify.Auth.signIn(...);
    
    + import { Amplify, Auth } from 'aws-amplify';
    + Amplify.configure(...);
    + // ...
    + Auth.signIn(...);

Amplify 4.x.x has breaking changes for React Native. Please see the breaking changes below:

  • If you are using React Native (vanilla or Expo), you will need to add the following React Native community dependencies:
    • @react-native-community/netinfo
    • @react-native-async-storage/async-storage
// React Native
yarn add aws-amplify amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage
npx pod-install

// Expo
yarn add aws-amplify @react-native-community/netinfo @react-native-async-storage/async-storage

Amplify 3.x.x has breaking changes. Please see the breaking changes below:

If you can't migrate to aws-sdk-js-v3 or rely on [email protected], you will need to import it separately.

  • If you are using exported paths within your Amplify JS application, (e.g. import from "@aws-amplify/analytics/lib/Analytics") this will now break and no longer will be supported. You will need to change to named imports:

    import { Analytics } from 'aws-amplify';
  • If you are using categories as Amplify.<Category>, this will no longer work and we recommend to import the category you are needing to use:

    import { Auth } from 'aws-amplify';

DataStore Docs

For more information on contributing to DataStore / how DataStore works, see the DataStore Docs

amplify-ui-swift-authenticator's People

Contributors

amazon-auto avatar harsh62 avatar rowbotnz avatar ruisebas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amplify-ui-swift-authenticator's Issues

Birthdate Attribute Mismatch between Cognito Settings and Authenticator UI

Description:
When using the Amplify UI Authenticator for SwiftUI, I've encountered an inconsistency between the Cognito user pool settings and the authenticator UI. Specifically, the birthdate attribute is set as required in my Cognito user pool settings. However, in the user interface of the authenticator, the birthdate field is presented as optional.

Steps to Reproduce:

Set the birthdate attribute as required in Cognito user pool settings.
Implement the Amplify UI Authenticator in a SwiftUI application.
Attempt to sign up without filling in the birthdate.
Actual Behavior:
The user is able to successfully create an account in the Cognito user pool without providing a birthdate.

Expected Behavior:
The birthdate should be required in the authenticator UI to match the Cognito user pool settings. If a user tries to sign up without providing a birthdate, they should receive an error and the account should not be created.

Screenshot 2023-08-24 at 9 57 01 AM

Screenshot 2023-08-24 at 9 58 45 AM

Error on Sign Up

Hi I just set up a project exactly as described here...

https://ui.docs.amplify.aws/swift/connected-components/authenticator

When I try to register a new user via the simulator I get this error...

2023-05-10 17:42:39.239082+0100 MobileApp[27776:408368] [SignUpState] Unable to Sign Up
2023-05-10 17:42:39.239325+0100 MobileApp[27776:408368] [SignUpState] The operation couldn’t be completed. (Amplify.AuthError error 3.)
2023-05-10 17:42:39.239549+0100 MobileApp[27776:408368] [AuthenticatorError] The operation couldn’t be completed. (Amplify.AuthError error 3.)
2023-05-10 17:42:39.239683+0100 MobileApp[27776:408368] [AuthenticatorError] Unknown error happened

I'm not sure how to begin de-bugging it

If I create a user via the Cognito console I can go through the force-change password steps and sign in with no problems

Example: Adding Documentation for Fully Custom 'SignUp' and 'Confirmation Code' Pages

Screenshot 2023-08-28 at 10 38 38 PM

Similar to the template above, I think it would be helpful to provide documentation for how to create and manage fields within a fully custom SignUp and Confirmation Code Page.

Ex.

  • If I wanted to create a Custom SignUp page that contains fields such as 'Username', 'Password', and 'ConfirmPassword', how would those fields be accessible from the state.
  • In addition, for a page such as the Confirmation Code page (the page after an email is sent with the code), how could you access the proper field?
  • Finally, if I wanted to switch to my Custom SignUpPage, the documentation for how to connect them together. I think that I am supposed to use state.move(to: <#T##AuthenticatorInitialStep#>) however it is unclear. With the example below, it is unclear how I would be able to move from one of my custom views into the other while still using Authenticator.
            Authenticator(
                signInContent: { state in
                    NewSignIn(state: state)
                }, signUpContent: { state in
                    NewSignUp(state: state)
                }
            ) { _ in

Thank you in advance!

Amplify and Authenticator

How did you install the Amplify CLI?

curl

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

12.4.0

What operating system are you using?

Mac

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No

Describe the bug

I am using the Authenticator class with Cognito for my app. Also using a custom login screen. All works well except for the timeout. I have a timeout setting up in AWS Cognito for 60 minutes under AppClient. But, once signed in the user is never signed out even after the token expires. Once the token expires the app misbehaves until I signout in the app and sign back in (obviously session data). When the token expires shouldnt the app re-challenge?

Expected behavior

App should signout when token expires.

Reproduction steps

Using Authenticator class signin

Project Identifier

No response

Log output

# Put your logs below this line


Additional information

No response

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.

Issue with label text and validation for email only login

I am using the "Use existing resources without the CLI" option as detailed here
I have configured cognito to use only email and password for login. However when using amplify-ui, it displays "username" instead of "email' in both the "create account" and "login" screens. No email validation is performed either.

image

My configuration file

{
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "IdentityManager": {
          "Default": {}
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "<MyPoolID>",
            "AppClientId": "<client id>",
            "Region": "eu-west-1"
          }
        },
        "Auth": {
          "Default": {
            "authenticationFlowType": "USER_SRP_AUTH",
            "passwordProtectionSettings": {
                "passwordPolicyMinLength": 8,
                "passwordPolicyCharacters": ["Requires Uppercase"]
            }
          }
        }
      }
    }
  }
}

Inputs get reset when @Published value is updated if AuthenticatorTheme is used

Every time the value of a @​Published property is updated, all the inputs get reset. (see video)
When removing the AuthenticatorTheme there is no problem.
Example code is attached.

RPReplay_Final1704317953.mp4
import SwiftUI
import Authenticator
import Amplify
import AWSCognitoAuthPlugin
import CoreLocation

class LocationDelegate: ObservableObject{
    @Published var location: CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: 10.0, longitude: 10.0)
    
    init() {
        Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { timer in
            self.location = CLLocationCoordinate2D(latitude: self.location.latitude + 0.01,
                                                   longitude: self.location.longitude)
        }
    }
}

@main
struct AuthTestApp: App {
    @StateObject private var locationManager = LocationDelegate()

    init() {
         do {
             try Amplify.add(plugin: AWSCognitoAuthPlugin())
             try Amplify.configure()
         } catch {
             print("Unable to configure Amplify \(error)")
         }
     }

    var body: some Scene {
        WindowGroup {
            ContentView()
                .environmentObject(locationManager)
        }
    }
}

struct ContentView: View {
    @EnvironmentObject private var locationManager: LocationDelegate

    var body: some View {
        TabView {
            AuthViewTheme()
                    .tabItem{
                        Image(systemName: "person.3")
                        Text("not ok (with theme)")
                    }.clipped()
            AuthViewNoTheme()
                    .tabItem{
                        Image(systemName: "person.3")
                        Text("ok (no theme)")
                    }.clipped()
        }
    }
}

struct AuthViewNoTheme: View {
    var body: some View {
        Authenticator { state in
        }
    }
}

struct AuthViewTheme: View {
    private let theme = AuthenticatorTheme()
    
    var body: some View {
        Authenticator { state in
        }
        .authenticatorTheme(theme)
    }
}

phonenumber field validation/error not shown correctly

Which Creating an account, in phonenumber field you can paste iphone keyboard suggested phone number in (408) 555-1212 format, which now can be submitted. But when error comes back from backend you can see ios log saying it is a phone number format error but on the screen you see a generic error that something went wrong.

Can we fix this to show the proper that phone number is in wrong format.

Thanks
Manish

Unable to reset password

Hi,

When trying to reset the password the error message "Passwords do not match." is shown, but the passwords do obviously match. (see image)

Using a version before 1.0.6 I'm able to reset the password.

IMG_4923

Toolbar Theme

I'd like to change the color of the toolbar so that it matches the header - I tried obvious stuff like...

                Authenticator(headerContent:{
                    ZStack{
                        Color.indigo
                        HStack{
                            Text("MyApp")
                                .foregroundColor(.white)
                        }
                        .padding()
                        
                    }
                    .frame(height: 100)
                }
                )
                {state in
                    Dashboard()
                }
                .authenticatorTheme(theme)
                .toolbarBackground(.indigo, for: .navigationBar)
                .toolbarBackground(.visible, for: .navigationBar)

Didn't seem to work, any ideas?

Title: Birthdate Attribute Error: String Must Be No Longer Than 10

Before creating a new issue, please confirm:

On which framework/platform are you having an issue?

iOS

Which UI component?

Authenticator

How is your app built?

IOS swift SwiftUI

What browsers are you seeing the problem on?

iOS (React Native)

Which region are you seeing the problem in?

East-1

Please describe your bug.

When entering a birthdate in the "YYYY-MM-DD" format, an error message is displayed: "Attributes did not conform to the schema: birthdate: String must be no longer than 10 characters." It seems that the birthdate validation expects exactly 10 characters, causing issues with certain date formats.

What's the expected behaviour?

The expected behavior is for the birthdate in the "YYYY-MM-DD" format to be accepted without errors.

Help us reproduce the bug!

using the amplify authenticator package with IOS swift swiftui and this error is being thrown when submitting birth date to cognito as an attribute for user creation

Code Snippet

// Put your code below this line.

Console log output

xcode Console log output:
"AuthError: Attributes did not conform to the schema: birthdate: String must be no longer than 10 characters"

Additional information and screenshots

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.