Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample uses authors Cognito unauth role without cross-account access to invoke a Lambda in the customer's account #2

Open
alanmur opened this issue Feb 5, 2020 · 1 comment

Comments

@alanmur
Copy link
Contributor

alanmur commented Feb 5, 2020

We need to add instructions on how to create a Cognito Identity Pool in the user's account so the unauthenticated player can invoke the client service Lambda. Presently we get:

Amazon.Lambda.AmazonLambdaException: User: arn:aws:sts::768788344492:assumed-role/Cognito_UltraFrogBattleRoyaleAnonPoolUnauth_Role/CognitoIdentityCredentials is not authorized to perform: lambda:InvokeFunction on resource: arn:aws:lambda:us-east-1:768788344492:function:ConnectUltraFrogRoyaleClient ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.Internal.UnityRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x0000e] in <63c2de57b2a5496ca21edbdf1b5cf408>:0
at Amazon.Runtime.Internal.HttpHandler1[TRequestContent].GetResponseCallbackHelper (System.Object state) [0x00023] in <63c2de57b2a5496ca21edbdf1b5cf408>:0 --- End of inner exception stack trace --- at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException (Amazon.Runtime.IExecutionContext executionContext, Amazon.Runtime.Internal.HttpErrorResponseException exception) [0x0013f] in <63c2de57b2a5496ca21edbdf1b5cf408>:0 at Amazon.Runtime.Internal.ExceptionHandler1[T].Handle (Amazon.Runtime.IExecutionContext executionContext, System.Exception exception) [0x00000] in <63c2de57b2a5496ca21edbdf1b5cf408>:0
at Amazon.Runtime.Internal.ErrorHandler.ProcessException (Amazon.Runtime.IExecutionContext executionContext, System.Exception exception) [0x0005c] in <63c2de57b2a5496ca21edbdf1b5cf408>:0
at Amazon.Runtime.Internal.ErrorHandler.InvokeAsyncCallback (Amazon.Runtime.IAsyncExecutionContext executionContext) [0x0002f] in <63c2de57b2a5496ca21edbdf1b5cf408>:0

@alanmur
Copy link
Contributor Author

alanmur commented Feb 5, 2020

Basically the gist is the user should

  1. go to this URL in us-east-1
  2. Click Create New Identity Pool
  3. Enter the name UltraFrogRoyale for identity pool name
  4. Check "Enable access to unauthenticated identities" box
  5. Click Create Pool
  6. Click View Details.
  7. In the lower section where it says "Your unauthenticated identities would like access to Cognito." click View Policy document.
  8. Click Edit next to the greyed out json document.
  9. Replace the json with the json in this file.
  10. At line 10, change the resource ARN in the role to the resource ARN of your Lambda Function.

With all else being equal, the only thing that changes is the AWS account number, which is what we wanted.

  1. Click Allow. This creates the Identity pool and gives you a bit of sample code showing the Identity Pool ID (in red)
  2. Copy the red Identity Pool ID and paste it into the sample code here, in place of the one that was checked in.
  3. Rebuild the client according to the instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant