Source: site.view [edit]
Function name: oauthValidated
Arguments:
Description: Receives validation token from LinkedIn
Page type: html
Render function:  
Module: skillsrank

Page source:

<webl>     WubCall("incHeader", []);      </webl>
<webl>     WubCall("incTop", ["home"]);         </webl>



<!-- content here 
============================================================ -->
<a name="content"></a>
	
<h1>OAuth Validated?</h1>

<webl>

var res = "oops";
   var accessToken = nil;
   var accessTokenSecret = nil;
  
   if Size(OPTIONALARGS) > 0 then
     // oauthio={|status|:|success|,|data|:{|oauth_token|:|8aaf3b8f-6500-46ce-a2ed-4d40dcd47c63|,|oauth_token_secret|:|423aaca8-d938-4a1c-b845-e2d9d1e91b77|},|provider|:|linkedin|
      var info = OPTIONALARGS[0];
      var i = Str_IndexOf("|oauth_token|:|", info);
      if (i > 0) then
          accessToken = Select(info, i+15, Size(info));
          i = Str_IndexOf("|", accessToken);
          accessToken = Select(accessToken, 0, i)
      end;
      i = Str_IndexOf("|oauth_token_secret|:|", info);
      if (i > 0) then
          accessTokenSecret = Select(info, i+22, Size(info));
          i = Str_IndexOf("|", accessTokenSecret);
          accessTokenSecret = Select(accessTokenSecret, 0, i)
      end;
      Wub_SetVaultValue("skillsrankLinkedInToken", accessToken);
      wubvars.accessToken := accessToken;
      Wub_SetVaultValue("skillsrankLinkedInSecretToken", accessTokenSecret);
      wubvars.accessTokenSecret := accessTokenSecret;
    
      res = `<h2>OAuth registration successful.</h2> <a href="/webl/WubHub_DoIt?cmdline=skillsrank.getConnections">Get Connections</a>`;
   end;
</webl>

<script>
  var d = document.URL;
  if (d.indexOf("#") > 0) {
     d = d.replace("#", '("').replace(/%22/g, '|') + '")';
     window.location = d;
    // alert(d);
  }
</script>

	</div>

<webl>     WubCall("incBottom", []);      </webl>
<webl>     WubCall("incSidemenuNavSite", ["home"]);    </webl>
<webl>     WubCall("incFooter", []);      </webl>