2017-05-05 63 views
0

我可以將授權碼重定向回重定向url,可以在oauth2.0 playground工具中看到。但是我在client_id,client_secret, grant_type和代碼從授權訪問server.Here令牌時是重定向URL發送授權代碼將帳戶與Google Home設備關聯時,授權授權流失敗

https://oauth-redirect.googleusercontent.com/r/skillid?state=xyz&code=aW1vbml

HTTP/1.1 400錯誤的請求 內容類型:應用/ JSON;字符集= UTF-8 { 「ERROR_DESCRIPTION」: 「錯誤的請求」, 「錯誤」: 「invalid_grant」}

OAuthASResponse.OAuthAuthorizationResponseBuilder builder = OAuthASResponse .authorizationResponse(request,HttpServletResponse.SC_FOUND);' builder.setParam("code", token); builder.setParam("state", state); final OAuthResponse response = builder.location(redirectURI).buildQueryMessage(); URI url = new URI(response.getLocationUri()); return Response.status(response.getResponseStatus()).location(url).build();

+0

您能否提供有關您正在使用哪個授權流程的其他詳細信息(隱式或授權代碼)? – Prisoner

+0

我正在使用授權授權代碼方法使用apache oltu oauth – abhi

回答

0

我終於發現,我必須使用@Formparameters挑發送請求授權授權流以授權代碼交換令牌。