Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
How to login with AWS Cognito without using native SDK

I want to authenticate my users using Cognito, for an app built in Flutter and Dart.

Unfortunately native AWS SDKs don't exist for Dart, and I can't use JS interop in Flutter.

I've looked at the OAuth2 flow, but that requires my users to be redirected to a login form, which isn't great for a mobile app.

What are the alternatives?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can try the amazon_cognito_identity_dart package which is written purely in Dart.

import 'package:amazon_cognito_identity_dart/cognito.dart';

final userPool = new CognitoUserPool(
    'ap-southeast-1_xxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxxxxxx');
final cognitoUser = new CognitoUser(
    'email@email.my', userPool);
final authDetails = new AuthenticationDetails(
    username: 'email@email.my', password: 'Password001');

CognitoUserSession session;
try {
  session = await cognitoUser.authenticateUser(authDetails);
} on CognitoUserException catch (e) {
  // handle CognitoUser exceptions
} catch (e) {
  print(e);
}

print(session.isValid());

See the Example Secure Counter App to get ideas on how to use it with Flutter.

Disclaimer: I am the original author of the package.

over 4 years ago · Santiago Trujillo Relatório

0

You can implement a backend service to validate Cognito credentials.

In this approach, you can implement a login screen in the mobile app which sends the user credentials to the backend. In the backend you can verify the credentials using Cognito SDK and issue a token that will be sent for subsequent API requests from mobile app.

You can use AWS API Gateway and Lambda to implement this.

For example refer this to implement a NodeJS backend.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda