craftcms / craftcms/cms

Unable to connect to Craft ID from CP

Open
#10,019 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

Hi,

I'm unable to connect to my Craft ID account from within the CP, after I login again I get the following :

    "error":"Argument 1 passed to craft\\helpers\\DateTimeHelper::secondsToInterval() must be of the type int, null given, called in /home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/services/PluginStore.php on line 76",
    "exception":"TypeError",
    "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/helpers/DateTimeHelper.php",
    "line":494,
    "trace":[
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/services/PluginStore.php",
            "line":76,
            "function":"secondsToInterval",
            "class":"craft\\helpers\\DateTimeHelper",
            "type":"::"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/controllers/PluginStoreController.php",
            "line":203,
            "function":"saveToken",
            "class":"craft\\services\\PluginStore",
            "type":"->"
        },
        {
            "function":"actionSaveToken",
            "class":"craft\\controllers\\PluginStoreController",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/yiisoft/yii2/base/InlineAction.php",
            "line":57,
            "function":"call_user_func_array"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/yiisoft/yii2/base/Controller.php",
            "line":181,
            "function":"runWithParams",
            "class":"yii\\base\\InlineAction",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/yiisoft/yii2/base/Module.php",
            "line":534,
            "function":"runAction",
            "class":"yii\\base\\Controller",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/web/Application.php",
            "line":287,
            "function":"runAction",
            "class":"yii\\base\\Module",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/web/Application.php",
            "line":596,
            "function":"runAction",
            "class":"craft\\web\\Application",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/craftcms/cms/src/web/Application.php",
            "line":266,
            "function":"_processActionRequest",
            "class":"craft\\web\\Application",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/vendor/yiisoft/yii2/base/Application.php",
            "line":392,
            "function":"handleRequest",
            "class":"craft\\web\\Application",
            "type":"->"
        },
        {
            "file":"/home/pmscomriedevelop/public_html/web/index.php",
            "line":22,
            "function":"run",
            "class":"yii\\base\\Application",
            "type":"->"
        }
    ]

I have seen this several times before but forgot to report.

Steps to reproduce
  • Click on Sign into Craft ID
  • Approve authorisation
  • Login again
Additional info
  • Craft version: 3.7.18
  • PHP version: 7.4
  • Database driver & version: mysql 5.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with craft/services/PluginStore.php at saveToken and inspect the DateTimeHelper::secondsToInterval call reported at craft/helpers/DateTimeHelper.php, then follow the Craft ID flow through craft/controllers/PluginStoreController.php. Reproduce the listed sign-in and authorization steps on Craft 3.7.18 with PHP 7.4 and verify that reconnecting completes without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.