0
0
IOT Protocolsdevops~10 mins

Username/password authentication in IOT Protocols - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the username for authentication.

IOT Protocols
client.username_pw_set(username=[1])
Drag options to blanks, or click blank then click option'
A"admin"
B"mqtt"
C"password"
D"user123"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the password instead of the username.
Using a keyword like 'mqtt' instead of a username.
2fill in blank
medium

Complete the code to set the password for authentication.

IOT Protocols
client.username_pw_set(password=[1])
Drag options to blanks, or click blank then click option'
A"user123"
B"admin"
C"pass123"
D"mqtt"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the username instead of the password.
Using a keyword like 'mqtt' instead of a password.
3fill in blank
hard

Fix the error in the code to correctly set username and password.

IOT Protocols
client.username_pw_set([1], [2])
Drag options to blanks, or click blank then click option'
A"user123", "pass123"
B"pass123", "user123"
C"user123"
D"pass123"
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping username and password arguments.
Passing only one argument instead of two.
4fill in blank
hard

Fill both blanks to create a dictionary with username and password keys.

IOT Protocols
credentials = {"username": [1], "password": [2]
Drag options to blanks, or click blank then click option'
A"user123"
B"pass123"
C"admin"
D"guest"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up username and password values.
Using incorrect strings that don't represent credentials.
5fill in blank
hard

Fill all three blanks to complete the function that sets username and password on a client.

IOT Protocols
def set_auth(client, [1], [2]):
    client.username_pw_set([3], [2])
Drag options to blanks, or click blank then click option'
Ausername
Bpassword
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent parameter names.
Swapping the order of username and password in the method call.