c# - How to Get Google Blogger Access Token In Windows Phone 8.1 Universal Apps -


i used below code access token throws method not implemented. how access token please me access token in windows phone 8.1 universal apps

stringbuilder authlink = new stringbuilder();              httpwebrequest webrequest = (httpwebrequest)webrequest.create("https://accounts.google.com/o/oauth2/token");             webrequest.contenttype = "application/x-www-form-urlencoded";             webrequest.method = "post";             authlink.appendformat("code={0}", "code");             authlink.appendformat("&client_id={0}", "xxxxxxxxxx.apps.googleusercontent.com");             authlink.appendformat("&client_secret={0}", "xxxxxxxxxx");             authlink.appendformat("&redirect_uri={0}", "urn:ietf:wg:oauth:2.0:oob");             authlink.append("&grant_type=authorization_code");             utf8encoding utfenc = new utf8encoding();             byte[] bytes = utfenc.getbytes(authlink.tostring());             stream os = null;              try // send post             {                  // count bytes send                 os =await webrequest.getrequeststreamasync();                 os.write(bytes, 0, bytes.length);        // send             }             catch (exception ex)              {             }             try // response             {                 httpwebresponse webresponse =(httpwebresponse)await webrequest.getresponseasync();                 if (webresponse == null)                  {                  }                 streamreader sr = new streamreader(webresponse.getresponsestream());                 string text = sr.readtoend().trim();                 //messagebox.show(sr.readtoend().trim());             }             catch (exception ex)              {              }         } 

you need check official api document, search "google blogger api" details.

i glanced @ document authorizing requests , identifying application, use oauth2.0 protocol, need use webauthenticationbroker class connect oauth provider.

see sample started: https://code.msdn.microsoft.com/windowsapps/web-authentication-d0485122


Comments