clientId not sent, or sent differently ?
See original GitHub issueHi, I suspect the ClientId is not sent properly.
I use clientid mobile_001
then I can subscribe to the topic:
device.subscribe(`$aws/things/mobile_001/shadow/update`);
Because the attached policy is defined with mobile_001 hardcoded:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [ "iot:Connect","iot:Receive", "iot:GetThingShadow"],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource":[
"arn:aws:iot:eu-west-1:xxxxxxxxxxxx:topicfilter/$aws/things/mobile_001/shadow/update"
]
}
]
}
But not when using ${iot:ClientId} instead of hardcoded mobile_001
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [ "iot:Connect","iot:Receive", "iot:GetThingShadow"],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iot:Subscribe",
"Resource":[
"arn:aws:iot:eu-west-1:xxxxxxxxxxxx:topicfilter/$aws/things/${iot:ClientId}/shadow/update"
]
}
]
}
Where the only difference is the use of the variable ${iot:ClientId} The variable should be replaced with the client id when AWS checks credentials but apparently is not, or the client id doesn’t match ‘mobile_001’
The debug information shows the ClientID correctly though
{ clientId: 'mobile_001',
region: 'eu-west-1',
debug: true,
host: 'xxxxxxxxx.iot.eu-west-1.amazonaws.com',
protocol: 'wss',
sessionToken: '',
accessKeyId: '',
secretKey: '',
reconnectPeriod: 1000,
fastDisconnectDetection: true,
port: 443,
websocketOptions: { protocol: 'mqttv3.1' } }
Any ideas ?
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
OAuth Client Credentials - Do not send client_id in body when ...
The Send as Basic Auth Header option keeps client_id in the body and breaks some OAuth implementations that are more strict.
Read more >1.8.5 dhclient not sending clientid correctly - Ubiquiti Community
Background: I have static IP from my ISP. I need to send my MAC address as Clientid, in order to get the correct...
Read more >How to pass client id and client secret to Application side ...
1 Answer 1 · Create clientId and secret and store it in the service client backend. · Ask logging in users for their...
Read more >Defining API key security schemes - IBM
When an API Key is not marked as a client_secret, it will not be protected in the API Manager UI. Specify whether the...
Read more >Consuming projections from non-IFS apps using OAuth2
Not implemented features; Using ROPC with IFS Database identity provider ... Applications can get access to IFS Applications using access tokens sent as ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for providing detailed information. We were able to reproduce the same error on our end. What we also found was this issue only affects one use case, which is when the clientId variable is used in a policy attached to authorized Cognito identities. For non-Cognito based principals and non-authorized Cognito roles, the clientId variable can be correctly evaluated.
Since this is a backend bug, we have forwarded it to the relevant team, who has acknowledged this issue and already started working on a fix for it.
We apologize any inconveniences caused. Please feel free to let us know if there’s anything else we could help. Thank you.
I guess you were referring to Cognito Identity Id that you want to use instead of client Id? If that’s the case, you can use this variable in your policy ${cognito-identity.amazonaws.com:sub}. You can find more details here http://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html in the Cognito documentation.