Problem/Motivation

I created a fresh access token at mapbox.com. It turns out at a length of 98 characters. The problem is the form on the module configuration page allows only a maximum of 96 characters (with a field size of 86).

Steps to reproduce

1. Create a new token at mapbox.com
2. Install module and try to enter it in the `Access Token` field

Proposed resolution

Extend the field length to allow the full token size.

Issue fork mapbox-3302050

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Amacado created an issue. See original summary.

Amacado’s picture

Status: Active » Needs review
StatusFileSize
new553 bytes

I created a patch and opened a pull request. Hope this helps someone! :-)

  • Amacado authored cdc71f1 on 1.0.x
    Issue #3302050: Mapbox token exceeds character limit
    
ahmed.raza’s picture

Status: Needs review » Fixed

Please update to 1.0.5 it fixes this issue.

ahmed.raza’s picture

Status: Fixed » Closed (fixed)
mattgh9152’s picture

This is now an issue again, as the Mapbox Access Key has increased in size further.

Can I recommend setting the max length to, say, 255, if it's required at all?

diff --git a/src/Form/ConfigForm.php b/src/Form/ConfigForm.php
index 2b6ec86..a3418ac 100644
--- a/src/Form/ConfigForm.php
+++ b/src/Form/ConfigForm.php
@@ -65,8 +65,8 @@ class ConfigForm extends ConfigFormBase {
     $form['access_token'] = [
       '#type' => 'textfield',
       '#title' => $this->stringTranslation->translate('Access Token'),
-      '#maxlength' => 98,
-      '#size' => 98,
+      '#maxlength' => 255,
+      '#size' => 255,
       '#required' => TRUE,
       '#default_value' => $config->get('access_token'),
     ];