Skip to content

Commit

Permalink
Merge pull request #28 from ibm-cloud-security/cdDocs
Browse files Browse the repository at this point in the history
changeDetails docs
  • Loading branch information
icemann92 committed Jan 13, 2020
2 parents 8fbb9ca + 8376370 commit fa90f5a
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 9 deletions.
248 changes: 246 additions & 2 deletions docs/AppID.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -1498,6 +1498,250 @@ <h5>Returns:</h5>







<h4 class="name" id="changeDetails"><span class="type-signature">(async) </span>changeDetails<span class="signature">(tokens)</span><span class="type-signature"> &rarr; {Promise.&lt;<a href="global.html#Tokens">Tokens</a>>}</span></h4>






<dl class="details">


<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line231">line 231</a>
</li></ul></dd>































</dl>





<div class="description">
<p>This method will open a popup to the change details widget for Cloud Directory users.<br>
You must enable users to manage their account from your app in Cloud Directory settings.</p>
</div>









<h5>Example</h5>

<pre class="prettyprint"><code>let tokens = {accessToken, idToken}
let newTokens = await appID.changeDetails(tokens);</code></pre>




<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>





<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>tokens</code></td>


<td class="type">


<span class="param-type">Object</span>



</td>





<td class="description last"><p>App ID tokens</p></td>
</tr>


</tbody>
</table>














<h5>Throws:</h5>
<ul>
<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing id token string&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>

<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing access token string&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>

<li>

<dl>
<dt>
<div class="param-desc">
<p>&quot;Missing tokens object&quot;</p>
</div>
</dt>
<dd></dd>
<dt>
<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">AppIDError</span>


</dd>
</dl>
</dt>
<dd></dd>
</dl>

</li>
</ul>


<h5>Returns:</h5>




<dl class="param-type">
<dt>
Type
</dt>
<dd>

<span class="param-type">Promise.&lt;<a href="global.html#Tokens">Tokens</a>></span>


</dd>
</dl>









Expand All @@ -1517,7 +1761,7 @@ <h5>Returns:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -329,7 +329,7 @@ <h5>Type:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -124,7 +124,7 @@ <h2 id="api-reference">API Reference</h2>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
45 changes: 42 additions & 3 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<nav >

<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AppID.html">AppID</a><ul class='methods'><li data-type='method'><a href="AppID.html#init">init</a></li><li data-type='method'><a href="AppID.html#signin">signin</a></li><li data-type='method'><a href="AppID.html#silentSignin">silentSignin</a></li><li data-type='method'><a href="AppID.html#getUserInfo">getUserInfo</a></li><li data-type='method'><a href="AppID.html#changePassword">changePassword</a></li><li data-type='method'><a href="AppID.html#changeDetails">changeDetails</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#Tokens">Tokens</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -252,14 +252,53 @@ <h1 class="page-title">index.js</h1>
}

const endpoint = this.openIdConfigResource.getIssuer() + constants.CHANGE_PASSWORD;
return this.utils.performOAuthFlowAndGetTokens({
return await this.utils.performOAuthFlowAndGetTokens({
userId,
origin: this.window.origin,
clientId: this.clientId,
endpoint
});
}

/**
* This method will open a popup to the change details widget for Cloud Directory users.
* You must enable users to manage their account from your app in Cloud Directory settings.
* @param {Object} tokens App ID tokens
* @returns {Promise&lt;Tokens>}
* @throws {AppIDError} "Missing id token string"
* @throws {AppIDError} "Missing access token string"
* @throws {AppIDError} "Missing tokens object"
* @example
* let tokens = {accessToken, idToken}
* let newTokens = await appID.changeDetails(tokens);
*/
async changeDetails({accessToken, idToken}) {
this._validateInitalize();

if (!accessToken &amp;&amp; typeof accessToken !== 'string') {
throw new AppIDError(constants.MISSING_ACCESS_TOKEN);
}

if (!idToken &amp;&amp; typeof idToken !== 'string') {
throw new AppIDError(constants.MISSING_ID_TOKEN);
}

const generateCodeUrl = this.openIdConfigResource.getIssuer() + constants.GENERATE_CODE;
const changeDetailsCode = await this.request(generateCodeUrl, {
headers: {
'Authorization': 'Bearer ' + accessToken + ' ' + idToken
}
});
const endpoint = this.openIdConfigResource.getIssuer() + constants.CHANGE_DETAILS;

return this.utils.performOAuthFlowAndGetTokens({
origin: this.window.origin,
clientId: this.clientId,
endpoint,
changeDetailsCode
});
}

/**
*
* @private
Expand All @@ -286,7 +325,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Mon Oct 28 2019 11:08:24 GMT-0500 (CDT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Thu Jan 09 2020 15:52:52 GMT-0600 (Central Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down

0 comments on commit fa90f5a

Please sign in to comment.