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

Implement Security Token to allow writes/deletes #1

Open
am283721 opened this issue Jun 17, 2019 · 1 comment
Open

Implement Security Token to allow writes/deletes #1

am283721 opened this issue Jun 17, 2019 · 1 comment

Comments

@am283721
Copy link
Contributor Author

Sample usage in exterior app:

if (!Rally.env.IoProvider.getSecurityToken()) {
    let resp = await Rally.environment.getIoProvider().httpGet({
        type: 'security/authorize',
    });

    if (!resp) { throw new Error(); }

    this._token = resp.SecurityToken;
    Rally.env.IoProvider.setSecurityToken(resp.SecurityToken);
} else if (!this._token) {
    this._token = Rally.env.IoProvider.getSecurityToken();
}

project.c_PermissionsRemovedDate = new Date().toISOString();

try {
    await this.client.save(project, {
        key: this._token
    });
} catch (e) {}

To remove Rally SDK dependency, fetch token similar to this:

auth() {
    return this.doRequest('get', {
      url: '/security/authorize'
    }).then((result) => {
      this._token = result.SecurityToken;
    });
  }

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

No branches or pull requests

1 participant