google app engine - Oauth 2.0 exchange authorization code for token : Invalid scheme for redirect uri -


मैं एक वेब अनुप्रयोग में एक टोकन प्राप्त प्राप्त प्राधिकरण कोड का आदान-प्रदान करने की कोशिश कर रहा हूं, लेकिन जब मैं GoogleAuthorizationCodeTokenRequest को कॉल करता हूं तो मुझे यह त्रुटि मिलती है : "Redirect_uri के लिए अमान्य पैरामीटर मान: अमान्य योजना:"

मैंने कई redirect_uri की कोशिश की है और पता नहीं क्यों मुझे यह त्रुटि मिलती है उड़ी डेवलपर कंसोल में मेरी रीडायरेक्ट उरी में है यहाँ मेरा कोड है: getauthcodeservlet.java में:

  स्ट्रिंग authcode = req.getParameter ("code"); स्ट्रिंग क्लाइंट आईडी = "CLIENTID_FROM_GOOGLEDEVELOPERSCONSOLE" स्ट्रिंग क्लाइंट SECT = "CLIENTSECRET_FROM_GOOGLEDEVELOPERSCONSOLE"; स्ट्रिंग पुनर्निर्देशन = "https://mapmydayunamur.appspot.com/getauthcodeservlet"; {GoogleTokenResponse प्रतिक्रिया = नया GoogleAuthorizationCodeTokenRequest (नया NetHttpTransport (), नई जैक्सनफैक्चर (), क्लाइंट आईडी, क्लाइंट सिक्रेट, एथोडकोड, रीडायर यूरी) प्रयास करें। एक्सक्यूट (); Resp.getWriter ()। Println ("प्रवेश टोकन:" + response.getAccessToken ()); } पकड़ (टोकनआरंसपेंसएक्सेप्शन ई) {अगर (ई.गेट विवरण)! = नल) {resp.getWriter ()। Println ("त्रुटि:" + ई.गेट.विवरण ()। GetError ()); अगर (ई.गेट डिटेल्स ()। GetErrorDescription ()! = नल) {resp.getWriter ()। Println (e.getDetails ()। GetErrorDescription ()); } यदि (ई.गेट.विवरण ()। GetErrorUri ()! = नल) {resp.getWriter ()। Println (ई.गेट। विवरण ()। GetErrorUri ()); }} और {resp.getWriter ()। Println (e.getMessage ()); }}}  

मेरी मदद करने के लिए धन्यवाद

समस्या का हल

  .setRedirectUri (getRedirectUri (req))  

और विधि को जोड़ने के माध्यम से redirect_uri को अपनाने

  स्थिर स्ट्रिंग getRedirectUri (HttpServletRequest req) {GenericUrl अनुरोध यूआरएल = नया जेनेरिक यूआरएल (req.getRequestURL ()। ToString ()); requestUrl.setRawPath ( "/ getauthcodeservlet"); वापसी अनुरोध यूआरएल.बिल्ड (); }  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -