export class AuthProvider {
    constructor(providerId, endpoint, scopes) {
        this.providerId = providerId;
        this.endpoint = endpoint;
        this.scopes = scopes;
    }
    addScope(scope) {
        this.scopes = this.scopes + ' ' + scope;
    }
    setCustomParameters(customOAuthParameters) {
        this.customParameters = customOAuthParameters;
    }
    url(clientId, redirectUri) {
        let params = '';
        if (!!this.customParameters) {
            for (const key of Object.keys(this.customParameters)) {
                params += '&' + key + '=' + this.customParameters[key];
            }
        }
        return this.endpoint + '?' +
            `response_type=token&` +
            `client_id=${clientId}&` +
            `redirect_uri=${redirectUri}&` +
            `scope=${this.scopes}` +
            params;
    }
}
