Skip to content

Add users.EnrollAuthFactor() method #254

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

Merged

Conversation

jonatascastro12
Copy link
Contributor

Description

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@jonatascastro12 jonatascastro12 requested a review from a team as a code owner September 6, 2023 16:02
@jonatascastro12 jonatascastro12 requested review from mthadley and removed request for a team September 6, 2023 16:02
@linear
Copy link

linear bot commented Sep 6, 2023

USRLD-1074 Add enrollAuthFactor method

curl https://api.workos.com/users/user_01H96FETWYSJMJEGF0Q3ZB272F/auth/factors \
  --header "Authorization: Bearer sk_test_a2V5XzAxSDBSRFRZQTZEWDFHWEdLOFRFVkRZM1EwLHdxa2lwaVY0UUtrWXdaYkNnRG84SVpoeDE" \
  -d type="totp"

Response

Status: 201 Created
Body: {
  "authentication_factor": {
    "object": "authentication_factor",
    "id": "auth_factor_01H96FETXENNY99ARX0GRC804C",
    "user_id": "user_01H96FETWYSJMJEGF0Q3ZB272F",
    "type": "totp",
    "totp": {
      "issuer": "Foo Corp",
      "qr_code": "data:image/png;base64,iVBOR...",
      "secret": "OFAFOQAPHR6XMQKAIYMWU72XIE3DGI3P",
      "uri": "otpauth://totp/Foo%20Corp:userfoo-corp.com?secret=OFAFOQAPHR6XMQKAIYMWU72XIE3DGI3P&issuer=Foo%20Corp&algorithm=SHA1&digits=6&period=30",
      "user": "userfoo-corp.com",
    },
    "created_at": "2023-08-31T18:59:57.962Z",
    "updated_at": "2023-08-31T18:59:57.962Z",
  },
  "authentication_challenge": {
    "object": "authentication_challenge",
    "id": "auth_challenge_01H96FETXGTW1QMBSBT2T36PW0",
    "authentication_factor_id": "auth_factor_01H96FETXENNY99ARX0GRC804C",
    "expires_at": "2023-08-31T19:09:57.999Z",
    "created_at": "2023-08-31T18:59:57.962Z",
    "updated_at": "2023-08-31T18:59:57.962Z",
  },
}

@jonatascastro12
Copy link
Contributor Author

jonatascastro12 commented Sep 6, 2023

@@ -160,7 +161,8 @@ type AuthenticateWithMagicAuthOpts struct {
}

type AuthenticationResponse struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ruby I think this is called AuthenticationFactorAndChallenge (or was 6 days ago, we may want to discuss standardization on this)

@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1156-add-missing-tests branch from 13953c4 to fd31240 Compare September 8, 2023 14:03
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1074-add-enrollauthfactor-method branch from d734a29 to 3de07ac Compare September 8, 2023 14:03
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1156-add-missing-tests branch from fd31240 to e0ebf21 Compare September 8, 2023 14:05
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1074-add-enrollauthfactor-method branch from 3de07ac to aec3db1 Compare September 8, 2023 14:05
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1156-add-missing-tests branch from e0ebf21 to e2e6bf6 Compare September 8, 2023 14:07
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1074-add-enrollauthfactor-method branch from aec3db1 to 1bd1be4 Compare September 8, 2023 14:07
Base automatically changed from feature/usrld-1156-add-missing-tests to main September 8, 2023 14:08
@jonatascastro12 jonatascastro12 force-pushed the feature/usrld-1074-add-enrollauthfactor-method branch from 1bd1be4 to 3961066 Compare September 8, 2023 14:08
@jonatascastro12 jonatascastro12 merged commit b1590fe into main Sep 8, 2023
@jonatascastro12 jonatascastro12 deleted the feature/usrld-1074-add-enrollauthfactor-method branch September 8, 2023 14:10
@jonatascastro12 jonatascastro12 mentioned this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants