Pieter de Loos
Pieter de Loos

Reputation: 11

Get Okta activation link through the API

After creating a new user in Okta, the end user must activate his/her account by clicking the link in the activation email. We do not want this email to be sent from an Okta.com mail address, so our intention is to send the activation email ourselves, so that the user receives the mail from a corporate mail address.

To accomplish this, we need to be able to retrieve the activation URL from the API. Is that possible?

Best regards,
Pieter.

Upvotes: 1

Views: 3669

Answers (3)

Andrew Van Beek
Andrew Van Beek

Reputation: 1

There is actually an api called activate for the user

https://developer.okta.com/docs/reference/api/users/#activate-user

If you send a request like so with sendEmail set to false like so below:

/api/v1/users/${userId}/lifecycle/activate?sendEmail=false

It should return an activationToken

{
  "activationUrl": "https://yourokta.okta.com/welcome/8y3998y9e689678",
  "activationToken": "XE6wE17zmphl3KqAPFxO"
}

Also important to note activation Tokens can be referenced in email templates as well just like recoveryTokens.

in your templates you put ${activationToken}. This way you can put this in your application urls like so:

href="http://localhost:3000/widget?resetToken=${recoveryToken}">Use recovery Token

Upvotes: 0

snorberhuis
snorberhuis

Reputation: 3276

You can now add a custom domain that Okta uses to send e-mail. The documentation is located here: https://help.okta.com/en/prev/Content/Topics/Settings/Settings_Configure_A_Custom_Email_Domain.htm

This option can be found in the Settings > Email & SMS settings.

Upvotes: 0

Matt Egan
Matt Egan

Reputation: 71

Yes,

See the Okta user state model here:

http://developer.okta.com/docs/api/resources/users.html#user-status

The user API will allow you to generate an activation link for a user that is in a 'STAGED' state.

When calling the activate lifecycle method a query parameter of 'sendEmail=false' should be sent to prevent Okta from sending the activation email and instead returning to you the activation URL. With the Activation URL in hand you can send the activation link (which should be considered sensitive in nature) as you see fit.

See addition Details here:

http://developer.okta.com/docs/api/resources/users.html#activate-user

-Matt

Upvotes: 2

Related Questions