Create fido2AuthenticationMethod
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create a new fido2AuthenticationMethod object.
Note
Self-service operations aren't currently supported.
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | UserAuthenticationMethod.ReadWrite.All | Not available. |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | UserAuthenticationMethod.ReadWrite.All | Not available. |
HTTP request
POST /users/{id}/authentication/fido2methods
Request headers
Name | Description |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json. Required. |
Request body
In the request body, supply a JSON representation of the fido2AuthenticationMethod object.
You can specify the following properties when creating a fido2AuthenticationMethod.
Property | Type | Description |
---|---|---|
displayName | String | Custom name given to the registered fido2AuthenticationMethod |
publicKeyCredential | webauthnPublicKeyCredential | Contains the WebAuthn public key credential information being registered |
Note
The publicKeyCredential|webAuthnPublicKeyCredential is a write-only property and is not returned in GET requests.
Currently, only attestation formats of "packed" or "None" are supported at this time.
Response
If successful, this method returns a 201 Created
response code and a fido2AuthenticationMethod object in the response body.
Examples
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/users/{id}/authentication/fido2Methods
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.fido2AuthenticationMethod",
"displayName": "Red Key",
"publicKeyCredential": {
"id": "pgIfj2fnom8rJdb4_h1gKqDkq-gxHFksI-m2aR5T-PNNycBfENAM4ksEBvoXky6d",
"response": {
"clientDataJSON": "VGhpcyBpcyB0aGUgY2xpZW50RGF0YUpTT04gZW5jb2RlZCB0byBiZSB3ZWJzYWZlIHdoaWNoIHdpbGwgYmUgc2VudCB0byBFbnRyYSBJRA",
"attestationObject": "VGhpcyBpcyB0aGUgYXR0ZXN0YXRpb25PYmplY3QgZW5jb2RlZCB0byBiZSB3ZWJzYWZlIHdoaWNoIHdpbGwgYmUgc2VudCB0byBFbnRyYSBJRA"
}
}
}
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.fido2AuthenticationMethod",
"id": "73ecec75-b546-cd6a-d74d-8bb81e58d4a7",
"displayName": "Red Key",
"createdDateTime": "2020-08-10T06:44:09Z",
"aaGuid": "2fc0579f-8113-47ea-b116-555a8db9202a",
"model": "NFC Key",
"attestationCertificates": [
"dbe793efdf1945e2df25d93653a1e8a3268a9075"
],
"attestationLevel": "attested"
}
Note
Ensure proper base64URL encoding and decoding of the publicKeyCredential.id is performed before you use the response data to create a passkey on a FIDO2 security key.