You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote the following to give this functionality in my bot
import{driver,methodCache,api,settings}from'@rocket.chat/sdk'import*ascryptofrom'crypto'api.post_2fa=async(endpoint,data,auth=undefined,ignore=undefined)=>{returnawaitapi.post(endpoint,data,auth,ignore).then((val)=>{if(val===undefined){// assume our error was TOTP-based (no way to tell because if success=false, undefined is returned)// here we mess with the global auth headersconstold_auth=api.authHeadersapi.authHeaders=Object.assign({'X-2fa-code': crypto.createHash('sha256').update(settings.password).digest('hex'),'X-2fa-method': 'password'},old_auth)try{returnapi.post(endpoint,data,auth,ignore)}finally{api.authHeaders=old_auth}}returnval})}
The text was updated successfully, but these errors were encountered:
I wrote the following to give this functionality in my bot
The text was updated successfully, but these errors were encountered: