-
Notifications
You must be signed in to change notification settings - Fork 594
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
Webtoken and cookie session value generated through typescript code is not valid #6463
Comments
Hey @bisingh-mdsol , Thanks for the feedback! I can't reproduce this issue. This is the steps I have -
import { MWAAClient, CreateWebLoginTokenCommand } from '@aws-sdk/client-mwaa'
const mwaaClient = new MWAAClient({ region: "us-west-2" })
const loginTokenCommand = new CreateWebLoginTokenCommand({ Name: "MyAirflowEnvironment" })
const response = await mwaaClient.send(loginTokenCommand)
const webServerHostName = response.WebServerHostname
const webToken = response.WebToken
console.log(webServerHostName, webToken) and run I can successfully get the Since you mentioned the webToken is not valid, May I know if you use python code to retrieve the webToken from the same environment? Could you please make sure python project and TS project has the same aws credentials and configuration? Thanks! |
Thank you @zshzbh for the quick response. Yes, I am retrieving web token from the same environment and the same aws credentials in python, It is working as expected from the Python code, the same format I am getting in typescript. But the token is not valid. Also, I created .sh file and ran the code, the token generated by .sh file is also working. I am wondering if the typescript token is authorized or not from aws sdk. Or please suggest to me if any alternative solution for this one. I am using typescript code, so I wanted to make it through the same. |
Hey @bisingh-mdsol , Thanks for the input. The AWS JS SDK and AWS Python SDK have the same service code, we auto generate the service code into different languages SDKs. So if the python code works well, the TS code should also work. While we investigating the root cause and workarounds, could you please also share the python code you use to generate the web token as well as the error message you have for validation error? Thanks! |
Hi @zshzbh , Here is the Python code for the same:
I am using this web token for aws_mwaa/login and from that I am getting a response with cookie session value which I will pass to Airflow api like get and post. We are able to generate webtoken and cookie session value from the code- TS and python but session value is valid for python only. Also here is the complete code for TS:
Please let me know what I am missing in the TS code. Once again thank you so much for looking into this issue. Hope we will have a solution. |
@zshzbh Hey, I tried the .js code of yours and it is working fine for webtoken. Could you please pass me .ts code for the same with all the parameters required for configs on MWAAClient like region and any credentials like aws keys and all? I tried to convert the code into typescript but it threw an error for missing credentials for signaturev4. |
Hey @bisingh-mdsol, Could you please share your ts code so that we can identify the root cause? I'd like to help you check where's the issue and fix the issue. : ) Thanks! |
I'm having this same issue.
I've noticed the following things:
|
Describe the issue
Hi Team,
Please consider below code:
const webToken = response.WebToken
In the above code, the web token we are getting is not valid for my application in typescript,
but when I am using the Python code, it works fine for my application.
Please advice.
Links
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/mwaa/command/CreateWebLoginTokenCommand/
The text was updated successfully, but these errors were encountered: