Skip to content

Decoder should replace all #11

Description

@michaelkantor

I'm not a user, but I did notice and copy your url_base64_decoder for a project of my own. I've noticed the following issue with it which you may want to fix:

https://github.com/auth0-blog/angular-token-auth/blob/master/auth.client.js#L5:

var output = str.replace('-', '+').replace('_', '/');

should in fact be doing a replace All:

const reg1 = new RegExp("_", "g");
const reg2 = new RegExp("-", "g");
let output = str.replace(reg2, '+').replace(reg1, '/');

Clarification: There is nothing limiting a string to a single "_" or "-" character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions