private String token ( final String home , final String code ) throws IOException { final String uri = new Href ( this . github ) . path ( PsGithub . LOGIN ) . path ( "oauth" ) . path ( PsGithub . ACCESS_TOKEN ) . toString ( ) ; return new JdkRequest ( uri ) . method ( "POST" ) . header ( "Accept" , "application/xml" ) . body ( ) . formParam ( "client_id" , this . app ) . formParam ( "redirect_uri" , home ) . formParam ( "client_secret" , this . key ) . formParam ( PsGithub . CODE , code ) . back ( ) . fetch ( ) . as ( RestResponse . class ) . assertStatus ( HttpURLConnection . HTTP_OK ) . as ( XmlResponse . class ) . assertXPath ( "/OAuth/access_token" ) . xml ( ) . xpath ( "/OAuth/access_token/text()" ) . get ( 0 ) ; }
Retrieve Github access token .