From 8339971202c116dbd023c006abc16d35a2730a28 Mon Sep 17 00:00:00 2001 From: Zack Katz Date: Thu, 2 May 2024 14:26:30 -0400 Subject: [PATCH] Add configuration warnings about front-end loading --- docs/Client/configuration.md | 6 ++++++ docs/Client/troubleshooting.md | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/Client/configuration.md b/docs/Client/configuration.md index 2c6624e..6848695 100644 --- a/docs/Client/configuration.md +++ b/docs/Client/configuration.md @@ -39,6 +39,12 @@ try { } ``` +:::warning +Make sure initialization happens before headers are sent. `init` is a good hook to use. + +**The hook must run on the front-end!** For example, don't use `admin_init`, since it will not run on the front-end. +::: + ## All configuration options {#all-options} | Key | Type | Description | Default | Required? | diff --git a/docs/Client/troubleshooting.md b/docs/Client/troubleshooting.md index 025fe83..6a6349b 100644 --- a/docs/Client/troubleshooting.md +++ b/docs/Client/troubleshooting.md @@ -3,6 +3,21 @@ title: Troubleshooting sidebar_label: Troubleshooting --- +## Redirects happen from the Connector plugin, but logins aren't happening. + +This can be caused by Client SDK initialization that is either too late, or initialization that doesn't occur on the front-end. (such as `admin_init`). + +- Check to make sure your initialization hook is early enough in the process. `init` is a good default. The `template_redirect` hook is the last possible hook you can use. [Here is an ordered list of WordPress hooks](https://developer.wordpress.org/apis/hooks/action-reference/). +- Make sure your initialization hook is also running on the front-end. If you are using `admin_init`, it will not run on the front-end. Use `init` instead. + +### Check the TrustedLogin SDK log + +- Enable [logging in the configuration array](/Client/configuration) by setting `logging/enabled` to `true` and `logging/threshold` to `debug`. +- Attempt a login. +- Check the log file (the default location of the log is located at `wp-content/uploads/trustedlogin-logs/trustedlogin-client-debug-{date}-{hash}-.log`) + +If there are no new log items, then the Client SDK is not being initialized, likely due to the initialization hook not being early enough in the process or not running on the front-end. + ## Troubleshooting the Grant Support Access screen First things first: make sure you have the [latest version of TrustedLogin](/Client/updating.md) installed.