mercredi 22 avril 2015

Need Help For Set Google Plus API in Grails

I am using Oauth plugin here id config.groovy code

oauth {
providers {
    google {
        api = org.scribe.builder.api.GoogleApi
        key = '455253656547-3vrklc5phr5shur4l97qhk56ej8o028v.apps.googleusercontent.com'
        secret = '4isGzW-iwKdwsHlEuPs3_-h3'
        scope = 'http://ift.tt/y4qatF'
        callback = "${grails.serverURL}/oauth/google/callback"
        successUri = "${grails.serverURL}/login/google"
    }
}

}

here ic login controller code

def google() {
    Token token = (Token) session[oauthService.findSessionKeyForAccessToken('google')]
    def googleResource = oauthService.getGoogleResource(token,
               grailsApplication.config.grails.google.api.url)
    def googleResponse = JSON.parse(googleResource?.getBody())

    log.info "token = ${token}"
    log.info "googleResponse = ${googleResponse}"
    log.info "accesstoken = ${token.token}"
    log.info "id = ${googleResponse.id}"
    log.info "name = ${googleResponse.name}"
    //println googleResponse.name
    //render params
    redirect(controller: "Profile",action:"dashboard")

  }

And here is error

2015-04-22 14:10:55,902 [http-bio-8080-exec-8] ERROR errors.GrailsExceptionResolver - OAuthException occurred when processing request: [GET] /uxsurvey/oauth/google/authenticate - parameters: redirectUrl: Response body is incorrect. Can't extract token and secret from this: 'Consumer is not registered: 455253656547-3vrklc5phr5shur4l97qhk56ej8o028v.apps.googleusercontent.com '. Stacktrace follows: Message: Response body is incorrect. Can't extract token and secret from this: 'Consumer is not registered: 455253656547-3vrklc5phr5shur4l97qhk56ej8o028v.apps.googleusercontent.com '

Here is google Api client ID Code

 Client ID
455253656547-3vrklc5phr5shur4l97qhk56ej8o028v.apps.googleusercontent.com
Email address
455253656547-3vrklc5phr5shur4l97qhk56ej8o028v@developer.gserviceaccount.com
Client secret
4isGzW-iwKdwsHlEuPs3_-h3
Redirect URIs

    http://localhost:8080/uxsurvey/login/google

Javascript Origins
none

Aucun commentaire:

Enregistrer un commentaire