Code Monkey home page Code Monkey logo

Comments (5)

DyfanJones avatar DyfanJones commented on September 3, 2024 1

I have found the bug. We accidentally removed all X-Amz-* headers when using anonymous. The dev branch should fix this.

remotes::install_github("dyfanjones/paws/paws.common", ref = "anonymous_cred")
library(paws)

svc <- cognitoidentityprovider(config(credentials(anonymous = T), region = "us-east-1"))

resp <- svc$initiate_auth(
  ClientId = "YOUR CLIENT ID",
  AuthFlow = "USER_PASSWORD_AUTH",
  AuthParameters = list(
    USERNAME = "YOUR USER NAME",
    PASSWORD = "YOUR PASSWORD"
  )
)

For extra context:
There is a slightly difference in how paws works compared to boto3 when getting credentials. Boto3 doesn't check if it has credentials where paws does (hence: Error: No compatible credentials provided.). I don't think we will remove this check as it is fairly useful and other aws sdk's do something similar.

Let me know if this fix works for you.

from paws.

DyfanJones avatar DyfanJones commented on September 3, 2024

Have you tried with anonymous credentials?

from paws.

cgostic avatar cgostic commented on September 3, 2024

Hi @DyfanJones, thanks for the reply!

I attempted to initialize the client with anonymous credentials according to documentation which suggests a logical value:

library(paws)
svc <- cognitoidentityprovider(
  credentials = list(anonymous=TRUE),
  region = "us-west-2"
)

svc$initiate_auth(
  ClientId = "<auth_client_id>",
  AuthFlow = "USER_PASSWORD_AUTH",
  AuthParameters = list(
    USERNAME = "<username>",
    PASSWORD = "<password>"
  )
)

This results in a "400 Bad Request" error, with the Amazon error type "Unknown Operation Exception".

INFO [2024-08-01 13:45:12.433]: <- HTTP/1.1 400 Bad Request
INFO [2024-08-01 13:45:12.433]: <- Date: Thu, 01 Aug 2024 20:45:12 GMT
INFO [2024-08-01 13:45:12.433]: <- Content-Type: application/x-amz-json-1.1
INFO [2024-08-01 13:45:12.433]: <- Content-Length: 38
INFO [2024-08-01 13:45:12.433]: <- Connection: keep-alive
INFO [2024-08-01 13:45:12.433]: <- x-amzn-RequestId: c8e39069-ad79-4755-920e-5f1e8f3afd0c
INFO [2024-08-01 13:45:12.433]: <- x-amzn-ErrorType: UnknownOperationException:
INFO [2024-08-01 13:45:12.433]: <- 
Error: UnknownOperationException (HTTP 400).

from paws.

DyfanJones avatar DyfanJones commented on September 3, 2024

Sorry about that, not sure what is going on. I will have to set up cognito to understand what is causing the issue.

from paws.

cgostic avatar cgostic commented on September 3, 2024

Yes, this does the trick! Thank you for the solution and the clarification. Really appreciate your time.

from paws.

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.