将帐户与 Google 家庭设备关联时授权授予流程失败

Authorization grant flow failed when linking account with Google Home device

我能够将授权代码重定向回重定向 url,这可以在 oauth2.0 playground tool.But 中看到 tool.But 我在 client_id 等参数中得到空值,client_secret,grant_type and code when accessing token from authorization server.Here 是重定向 url 发送授权码

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

Http/1.1 400 Bad Request Content-type: application/json; charset=UTF-8 { "error_description": "Bad Request", "error": "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();

我终于发现我必须使用@Formparameters 来选择post 授权授权流程请求以使用授权代码交换令牌。