Added in @stytch/vanilla-js v5.44
authenticateByUrl() method.
This method parses the current page’s URL params and calls the appropriate authenticate() method associated with the token.
authenticateByUrl takes an option object with one required property, session_duration_minutes. Other properties are passed through to the underlying authenticate() method.
Set the session lifetime to be this many minutes from now.This value must be a minimum of 5 and may not exceed the maximum session duration minutes value set in the Frontend SDK page of the Stytch Dashboard.This param is optional for discovery email link and impersonation token types, but because this function can be used for any type of token, this param is typed as required.
data property.
handled property on the returned object will be false. Use the token property to call the resetByEmail() method.
null.
parseAuthenticateUrl
If you only want to get the token without callingauthenticate(), you can use parseAuthenticateUrl(). This function returns synchronously and can be useful if you want to check the token type before calling authenticate.
The following token types can be returned:
- discovery
- discovery_oauth
- oauth
- sso
- multi_tenant_magic_links
- multi_tenant_impersonation
- multi_tenant_passwords (not handled)
- login (not handled)
authenticateByUrl can handle, the method will also return handled: true.
null.