Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[redgifs] fix 'token' extraction #3081

Closed
wants to merge 1 commit into from

Conversation

enduser420
Copy link
Contributor

@enduser420 enduser420 commented Oct 20, 2022

Closes #3080

https://github.com/Redgifs/api/wiki/Temporary-tokens

if (g instanceof FormData || g instanceof URLSearchParams || m.append('Content-Type', 'application/json'), !u) {
    const e = l || await Object(n['f'])();
    if (e) m.append('Authorization', 'Bearer ' + e);
    else {
        const e = await this.getTemporaryToken();
        e && m.append('Authorization', 'Bearer ' + e)
    }
}
async getTemporaryToken() {
    if (!this.temporaryToken) {
        const e = await this._request('GET', '/v2/auth/temporary', {
        }, {
            anon: !0
        });
        this.temporaryToken = e.token,
            console.debug('[auth] temporary token updated = ' + this.temporaryToken)
    }
    return this.temporaryToken
}

@enduser420 enduser420 changed the title [redgifs] fix 'token' extraction (#3080) [redgifs] fix 'token' extraction Oct 20, 2022
mikf added a commit that referenced this pull request Oct 21, 2022
@mikf
Copy link
Owner

mikf commented Oct 21, 2022

Thank you for the quick fix, but I'd rather do this a slightly different way than it was before, given that the new tokens are temporary and might expire rather quickly. (04d3ebd)

@mikf mikf closed this Oct 21, 2022
@enduser420 enduser420 deleted the extractor/redgifs branch October 21, 2022 13:18
mikf added a commit that referenced this pull request Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[redgifs] Failed to get Bearer token due to concatenation error
2 participants