Coder Social home page Coder Social logo

Comments (10)

assyadh avatar assyadh commented on June 14, 2024

The values you entered look correct. Are you sure there is no white space?

When is the error occurring?

Do you have the AWS Cli or toolkit for visual studio installed with a default profile?

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

When I fill out the register (new account) form and submit the form. Occurs on page Register.cshtml.cs:
When the userManager.CreateAsync function is called.
No white spaces in the settings.

public async Task OnPostAsync(string returnUrl = null)
{
returnUrl = returnUrl ?? Url.Content("~/");
if (ModelState.IsValid)
{
var user = _pool.GetUser(Input.UserName);
user.Attributes.Add(CognitoAttribute.Email.AttributeName, Input.Email);
user.Attributes.Add(CognitoAttribute.PhoneNumber.AttributeName, Input.Phone);

            var result = await _userManager.CreateAsync(user, Input.Password);

It's a brand new ASPNetCore 2.1.1 Web Application with your sample code ported in. Not sure what AWS Cli (is installed on this dev box) has to do with this issue as that is not called during the DotNetCore code execution.

Installed
Identity.Cognito 1.0.0
Extensions.CognitoAuthentication 1.0.3
ASPNETCore.App 2.1.1
ASPNETCore.Razor.Design 2.1.2
NETCore.App 2.1.0
VisualStudio.Web.CodeGeneration.Design 2.1.7

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

I have not added any of the other AWS DotNet SDKs yet as this is a blank (standard DotNet Core template) project and I was first trying to get it to substitute Cognito for the normal DotNet db/authentication before adding anything else in.

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

The code that is being executed is ported in verbatim from:
So created a brand new project, ported in "all" code/references/libraries/etc.

https://github.com/aws/aws-aspnet-cognito-identity-provider/tree/master/samples/Samples

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

I would just like to get it to work. I can upload the entire project for you if you like. What I did is a newer update from your original sample project with regards to the DotNet version used. I could simply delete the Cognito accounts and create new ones afterwords. If we get it to work you could post this as a "new/updated" working sample for the community.

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

I tried loading/running your Samples.sln project. It does compile but it errors out when you try to run it.

An unhandled exception occurred while processing the request.
UriFormatException: Invalid URI: The hostname could not be parsed.
System.Uri.CreateThis(string uri, bool dontEscape, UriKind uriKind)

TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeMethodHandle.InvokeMethod(object target, object[] arguments, Signature sig, bool constructor, bool wrapExceptions)

UriFormatException: Invalid URI: The hostname could not be parsed.
System.Uri.CreateThis(string uri, bool dontEscape, UriKind uriKind)
System.Uri..ctor(string uriString)
Amazon.Runtime.ClientConfig.GetUrl(RegionEndpoint regionEndpoint, string regionEndpointServiceName, bool useHttp, bool useDualStack) in ClientConfig.cs
Amazon.Runtime.ClientConfig.DetermineServiceURL() in ClientConfig.cs
Amazon.Runtime.Internal.DefaultRetryPolicy..ctor(IClientConfig config) in DefaultRetryPolicy.cs
Amazon.Runtime.AmazonServiceClient.BuildRuntimePipeline() in AmazonServiceClient.cs

Anyway mines initializes just fine. Only seems to have an issue with the credentials.

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

I did put in the appsettings.json settings similar to my own project as they are missing in the sample of course.

from aws-aspnet-cognito-identity-provider.

assyadh avatar assyadh commented on June 14, 2024

Hi,

This definitely looks like a credentials issue.

You don't need to add any other SDK, they are already referenced by the NuGet packages.

Sorry for not responding earlier, I have been pulled into various other issues.

Can you follow the instructions here:

https://github.com/aws/aws-aspnet-cognito-identity-provider/blob/master/docs/1-Setup.md

Especially around setting up the Visual Studio Toolkit and a default AWS Profile.

While working on a development environment, the SDKs need access to credentials. This is done by setting up a profile using the AWS CLI:

https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/setup.html

https://docs.aws.amazon.com/sdk-for-net/v3/ndg/welcome.html

This is not required in a production environment as the credentials will be retrieve from the EC2 instance metadata.

Feel free to upload the project for me, I can have a look, just make sure to obfuscate any secrets.

It may work on my machine as I have the CLI installed with a default profile, I will let you know once the project is uploaded.

from aws-aspnet-cognito-identity-provider.

biznearme avatar biznearme commented on June 14, 2024

from aws-aspnet-cognito-identity-provider.

assyadh avatar assyadh commented on June 14, 2024

Might be related to: #80

from aws-aspnet-cognito-identity-provider.

Related Issues (20)

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.