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

Undefined array key "version" #2625

Open
Wotuu opened this issue Nov 21, 2024 · 0 comments
Open

Undefined array key "version" #2625

Wotuu opened this issue Nov 21, 2024 · 0 comments
Assignees
Labels
bug Something isn't working patreon

Comments

@Wotuu
Copy link
Contributor

Wotuu commented Nov 21, 2024

{
    "correlationId": "b618034a-da07-4a17-8e3d-a7aace1b5b01",
    "userId": 49117
}
On laravel-serializable-closure://function (\Illuminate\Http\Request $request, \App\Service\Patreon\PatreonApiServiceInterface $patreonApiService, \App\Service\Patreon\PatreonServiceInterface $patreonService): \Illuminate\Http\RedirectResponse
    {
        $state = $request->get('state');
        $code  = $request->get('code');

        // If session was not expired
        if (csrf_token() === $state) {
            // Replace http://localhost:5000/oauth/redirect with your own uri
            $redirect_uri = route('patreon.link');

            $tokens = $patreonApiService->getAccessTokenFromCode($code, $redirect_uri);
            if (!isset($tokens['error'])) {
                $user = \Illuminate\Support\Facades\Auth::user();

                // Save new tokens to database
                // Delete existing patreon data, if any
                $user->patreonUserLink?->delete();

                $patreonUserLinkAttributes = [
                    'user_id'       => $user->id,
                    'scope'         => $tokens['scope'],
                    'access_token'  => $tokens['access_token'],
                    'refresh_token' => $tokens['refresh_token'],
                    'version'       => $tokens['version'],
                    'expires_at'    => date('Y-m-d H:i:s', time() + $tokens['expires_in']),
                ];
@Wotuu Wotuu added bug Something isn't working patreon labels Nov 21, 2024
@Wotuu Wotuu self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patreon
Projects
None yet
Development

No branches or pull requests

1 participant