#include "pch.h"
#include "Internal.h"

using namespace TwitchInGames;

ServerAuth::ServerAuth() {}

ServerAuth::~ServerAuth() {}

std::future<tstring> ServerAuth::StartAuth(string_t clientId, string_t redirectUri, std::vector<string_t> const& scopes, tstring& state) {
	refreshToken.clear();
	return BrowserAuth::Launch(clientId, redirectUri, _T("code"), scopes, state);
}

void ServerAuth::Finish(string_t accessToken, string_t refreshToken_) {
	refreshToken= refreshToken_;
	Stop(accessToken);
}

void ServerAuth::Cancel() {
	Stop(_T(""));
}

tstring ServerAuth::GetRefreshToken() const {
	return refreshToken;
}
