DEVELOPER CENTER
...
JavaScript
Libraries
$pinc.oauth
4min
the pinc oauth library gives you the ability to modify your user experiences by invoking event callbacks events attach an event handler once the user consents attach an event handler to watch post user consent this is a positive event and only fires if consented //$pinc onload is called by the pathfix library once the page base libraries are loaded function $pinc onload(){ //watch if the user has consented $pinc events on("$pinc oauth","consented",(data)=>{ console log(data); },true) } handler arguments (data) { provider "providername" } check if the user has previously consented an integration the oauth library allows you to check if the current user has already consented an integration this is useful if you have a return user to your integration page and would like to alter the user experience base on whether your user has previously consented or not 	 function checkauthorized(){ 	var provider = "googlemail"; 	var userid = "user\@myapp com" 	//set the userid to null and it will user the default provided in the data user id attribute 	$pinc oauth authorized(provider, userid, (authorized)=>{ 	 console log(authorized); 	}) } 	 arguments provider required internal name of the provider can be found here userid optional your end user id this defaults to the value specified in data user id attribute of the script element the value if specified acts as an override callback response boolean