Search code examples
google-dfp

Throwing 404 error with the authoriseUrl generated from GetRefreshToken


I am trying to create a sample project which consumes DFP services. Till now : Still in authentication part :

a) Successfully created clientId, while creating new Client Id have checked installed apps options in the Google developer console.

b) Added the clientId, clientSecret to ads.properties .

Note : Took dfp-axis-jars-and-examples-2.2.0.tar and making my changes in it[by importing project in IDE].

c) I ran into trouble while trying to paste the authoriseUrl in the browser after running GetRefreshToken.

Please find below the error :

"The redirect URI in the request: urn:ietf:wg:oauth:2.0:oob can only be used by a Client ID for native application. It is not allowed for the 'WEB' client type. You can create a Client ID for native application in the Credentials section of the Google Developers Console."

I believe I have selected the wrong applicationType while creating new ClientId . Appreciate inputs .


Solution

  • After closing looking at the authoriseUrl, it seemed I was sending the wrong redirectUrl.

    I forgot to copy paste the redirectUrl generated from the creation of client id in the GetRefreshToken callback property:

    private static final String CALLBACK_URL = "https://www.example.com/oauth2callback";//"urn:ietf:wg:oauth:2.0:oob";
    

    No error now :).