Skip to content

Wrong message structure may cause token unset #9

@nick-cjyx9

Description

@nick-cjyx9

Description

This is the message pattern the repo is using

'authorization:github:${status}:${JSON.stringify(content)}',

which will return messages like authorization:github:success:"data: gho_xxxxxxx"

and decap is now using JSON.parse to parse this field of information, see

https://github.com/decaporg/decap-cms/blob/5940784fc6e8ef1a498c6c942c5caa15d6c47b92/packages/decap-cms-lib-auth/src/netlify-auth.js#L60

JSON.parse("data: gho_xxxxxxx") returns a string type variable which will cause decap cannot get the access_token.

My Solution to this

// ...
    'authorization:github:${status}:${content}',
// ...
  const responseBody = renderBody('success', `{"token":"${token}"}`)
// ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions