[{"data":1,"prerenderedAt":194},["ShallowReactive",2],{"docs-nav-\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fsigning-the-user-out":3,"\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fsigning-the-user-out":92},[4],{"title":5,"path":6,"stem":7,"children":8,"page":46},"Account Sharing","\u002Fdocs\u002Faccount-sharing","1.docs\u002F2.account sharing",[9,13,17,21,47,72],{"title":10,"path":11,"stem":12},"How it works","\u002Fdocs\u002Faccount-sharing\u002Fhow-account-sharing-prevention-works","1.docs\u002F2.account sharing\u002F0.How account sharing prevention works",{"title":14,"path":15,"stem":16},"Quick start","\u002Fdocs\u002Faccount-sharing\u002Fquick-start","1.docs\u002F2.account sharing\u002F1.Quick start",{"title":18,"path":19,"stem":20},"Events & actions","\u002Fdocs\u002Faccount-sharing\u002Flisten-to-events","1.docs\u002F2.account sharing\u002F2.Listen to events",{"title":22,"path":23,"stem":24,"children":25,"page":46},"Concepts","\u002Fdocs\u002Faccount-sharing\u002Fconcepts","1.docs\u002F2.account sharing\u002F4.Concepts",[26,30,34,38,42],{"title":27,"path":28,"stem":29},"Challenges","\u002Fdocs\u002Faccount-sharing\u002Fconcepts\u002Fchallenges","1.docs\u002F2.account sharing\u002F4.Concepts\u002F0.challenges",{"title":31,"path":32,"stem":33},"Device limits","\u002Fdocs\u002Faccount-sharing\u002Fconcepts\u002Fconfigure-device-limits","1.docs\u002F2.account sharing\u002F4.Concepts\u002F1.configure-device-limits",{"title":35,"path":36,"stem":37},"Groups","\u002Fdocs\u002Faccount-sharing\u002Fconcepts\u002Fgroups","1.docs\u002F2.account sharing\u002F4.Concepts\u002F2.groups",{"title":39,"path":40,"stem":41},"Automatically detach devices","\u002Fdocs\u002Faccount-sharing\u002Fconcepts\u002Fautomatically-detaching-devices","1.docs\u002F2.account sharing\u002F4.Concepts\u002F3.automatically-detaching-devices",{"title":43,"path":44,"stem":45},"Excluded Devices","\u002Fdocs\u002Faccount-sharing\u002Fconcepts\u002Fexcluded-devices","1.docs\u002F2.account sharing\u002F4.Concepts\u002F4.excluded-devices",false,{"title":48,"path":49,"stem":50,"children":51,"page":46},"Advanced","\u002Fdocs\u002Faccount-sharing\u002Fadvanced","1.docs\u002F2.account sharing\u002F8.Advanced",[52,56,60,64,68],{"title":53,"path":54,"stem":55},"Signing the user out","\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fsigning-the-user-out","1.docs\u002F2.account sharing\u002F8.Advanced\u002F1.Signing the user out",{"title":57,"path":58,"stem":59},"Webhooks","\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fwebhooks","1.docs\u002F2.account sharing\u002F8.Advanced\u002F2.webhooks",{"title":61,"path":62,"stem":63},"Metadata","\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fusing-metadata","1.docs\u002F2.account sharing\u002F8.Advanced\u002F3.Using metadata",{"title":65,"path":66,"stem":67},"When to attach","\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Fwhen-to-call-the-attach-function","1.docs\u002F2.account sharing\u002F8.Advanced\u002F5.When to call the attach function",{"title":69,"path":70,"stem":71},"Tracking conversions","\u002Fdocs\u002Faccount-sharing\u002Fadvanced\u002Ftracking-conversions","1.docs\u002F2.account sharing\u002F8.Advanced\u002F8.Tracking conversions",{"title":73,"path":74,"stem":75,"children":76,"page":46},"Signals","\u002Fdocs\u002Faccount-sharing\u002Fsignals","1.docs\u002F2.account sharing\u002F9.Signals",[77,81,85,89],{"title":78,"path":79,"stem":80},"High velocity","\u002Fdocs\u002Faccount-sharing\u002Fsignals\u002Fhigh-velocity","1.docs\u002F2.account sharing\u002F9.Signals\u002F1.High velocity",{"title":82,"path":83,"stem":84},"Impossible travel","\u002Fdocs\u002Faccount-sharing\u002Fsignals\u002Fimpossible-travel","1.docs\u002F2.account sharing\u002F9.Signals\u002F2.Impossible travel",{"title":86,"path":87,"stem":88},"Concurrency","\u002Fdocs\u002Faccount-sharing\u002Fsignals\u002Fconcurrency","1.docs\u002F2.account sharing\u002F9.Signals\u002F3.Concurrency",{"title":31,"path":90,"stem":91},"\u002Fdocs\u002Faccount-sharing\u002Fsignals\u002Fdevice-limits","1.docs\u002F2.account sharing\u002F9.Signals\u002F4.Device limits",{"id":93,"title":53,"body":94,"description":187,"extension":188,"meta":189,"navigation":190,"path":54,"seo":191,"sitemap":192,"stem":55,"__hash__":193},"docs\u002F1.docs\u002F2.account sharing\u002F8.Advanced\u002F1.Signing the user out.md",{"type":95,"value":96,"toc":180},"minimark",[97,101,105,113,118,125,146,149,153,167,173],[98,99,53],"h1",{"id":100},"signing-the-user-out",[102,103,104],"p",{},"Whenever a device is detached, the owner\u002Fuser of that device should be logged out immediately. Let's take a closer look at some scenarios and how to handle them.",[102,106,107,108,112],{},"If the devices are offline, but and they get detached, you can simply leave it there. The next time the offline device comes online and gets ",[109,110,111],"code",{},"attach","ed, the logic will re-run and Rupt will re-evaluate the attached devices.",[114,115,117],"h3",{"id":116},"device-is-online-and-is-detached-by-another-device-or-for-inactivity","Device is online and is detached (by another device or for inactivity)",[102,119,120,121,124],{},"Rupt automatically handles notifying the devices if they are online. We use realtime APIs to send a notification to the SDK which will redirect the detached device to ",[109,122,123],{},"redirect_urls.logout_url",". You must add this callback with the proper logout url to see the results.",[126,127,129],"alert",{"type":128},"danger",[102,130,131,135,136,142,143,145],{},[132,133,134],"strong",{},"Important","\nYou must add the ",[137,138,140],"a",{"href":139},"\u002Fapi\u002Ffunctions\u002Fattach-a-device#on-current-device-logout",[109,141,123],{}," parameter to the ",[109,144,111],{}," function for realtime detach handling to work properly",[147,148],"br",{},[114,150,152],{"id":151},"device-is-offline-and-is-detached-by-another-device-or-for-inactivity","Device is offline and is detached (by another device or for inactivity)",[102,154,155,156,159,160,163,164,166],{},"Because the device is offline, there is no realtime communication between Rupt's servers and the device. So we cannot notify it immediately. Instead, Rupt's servers send a webhook event of type ",[109,157,158],{},"device.detached"," which include the device information and any ",[109,161,162],{},"metadata"," that was added to the device on the ",[109,165,111],{}," request.",[102,168,169,170,172],{},"If you implement the webhooks, when you receive the event, you should expire the user session, delete their login cookies or expire their bearer token. Because the user will have multiple sessions, you can send an identifier in the ",[109,171,162],{}," and use that to select which session to logout.",[102,174,175,176,179],{},"Take a look at the ",[137,177,178],{"href":58},"Handle webhook events"," guide.",{"title":181,"searchDepth":182,"depth":182,"links":183},"",2,[184,186],{"id":116,"depth":185,"text":117},3,{"id":151,"depth":185,"text":152},"Different ways to ensure the user is logged out when they need to be.","md",{},true,{"title":53,"description":187},{"loc":54},"VREH0oBLQJ8z5ZCreCKJpjGQPm6h6U9NGlIg5cl2lLQ",1776716926795]