tokenManager->createToken($this->currentUser)->plainTextToken )); $url = sprintf('https://www.last.fm/api/auth/?api_key=%s&cb=%s', config('koel.lastfm.key'), $callbackUrl); return redirect($url); } public function callback(LastfmCallbackRequest $request) { $sessionKey = $this->lastfm->getSessionKey($request->token); abort_unless((bool) $sessionKey, Response::HTTP_INTERNAL_SERVER_ERROR, 'Invalid token key.'); $this->lastfm->setUserSessionKey($this->currentUser, $sessionKey); // delete the tmp. token we created earlier $this->tokenManager->deleteTokenByPlainTextToken($request->api_token); return view('lastfm.callback'); } }