Skip to content

Commit

Permalink
Fix Platform check
Browse files Browse the repository at this point in the history
Improve error message and use AuthError type
  • Loading branch information
hzalaz committed Aug 17, 2017
1 parent 2879b66 commit fa3704e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion webauth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,18 @@ export default class WebAuth {
* @memberof WebAuth
*/
clearSession(options = {}) {
if (Platform.OS !== 'ios') {
return Promise.reject(new AuthError({
json: {
error: 'a0.platform.not_available',
error_description: `Cannot perform operation in platform ${Platform.OS}`
},
status: 0
}));
}
const { clientId, domain, client, agent } = this;
const federated = options.federated || false;
return new Promise(function (resolve, reject) {
if (Platform.OS !== 'ios') { reject(new Error('clearSession only supported in iOS')); }
const logoutURL = `https://${domain}/v2/logout${federated ? '?federated' : ''}`;
console.log(logoutURL);
A0Auth0.didLoadURL(logoutURL, function (err, data) {
Expand Down

0 comments on commit fa3704e

Please sign in to comment.