SOLVED

How do you get access token from identity URL?

Go to solution
Anonymous
Not applicable

How do you get access token from identity URL?

I try to perform the GET request to the Identity URL for the access token, but I get an UnknownHostException from Java. I followed the setup of the Custom Service to the letter. What could I have missed?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: How do you get access token from identity URL?

I tried to connect your identity server URL at Safari.
It caused 'Failed to open".
But normaly, it caused 403 forbidden.
This is not your DNS probrem.
It seem your Identity server is down really.
Contact your marketo support.
0EM50000000StQZ.jpg

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Re: How do you get access token from identity URL?

Hi David

I think your exception is http 404 error and it's simply bad url.
Check you url is Identity url insted of endpoint.
Or you give me request and respons detail.
- Request sample
- Exceprion message

I see this document and it work fine.
http://developers.marketo.com/documentation/rest/authentication/
 
Kenny_Elkington
Marketo Employee

Re: How do you get access token from identity URL?

Hi David,

It's possible that your UnknownHostException is occurring because the Java is unable to resolve the host on your machine.  A quick test would be to open this URI in your browser and to log the same result to the console with System.out.printLine in Java: <Identity Service URL>/oauth/token?grant_type=client_credentials&client_id=<custom_service_client_id>&client_secret=<custom_service_client_secret>  If you still get the UnknownHostException, then it's an issue with resolving the host and you'll need to look into either the DNS configuration for the machine your trying to execute the requets in Java with.
Anonymous
Not applicable

Re: How do you get access token from identity URL?

Here is my sample request:

new HTTPBuilder( 'https://740-BJS-997.mktorest.com' ).request( Method.GET ){
    uri.path = '/identity/oauth/token'
    uri.query = [ grant_type: 'client_credentials',
                  client_id: CLIENT_ID,
                  client_secret: CLIENT_SECRET ]
}

And my exception message:

java.net.UnknownHostException: 740-BJS-997.mktorest.com: nodename nor servname provided, or not known
    at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:278)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:162)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1066)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044)
    at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
    at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:434)
    at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:366)
    at groovyx.net.http.HTTPBuilder$request.call(Unknown Source)
    at Test.run(Test.groovy:7)

It might be DNS, but how can I resolve it? I'm using 8.8.8.8 and 8.8.4.4 as my DNS servers.

If it's relevant, I'm using OS X Yosemite.

Thanks, guys.
Anonymous
Not applicable

Re: How do you get access token from identity URL?

I tried to connect your identity server URL at Safari.
It caused 'Failed to open".
But normaly, it caused 403 forbidden.
This is not your DNS probrem.
It seem your Identity server is down really.
Contact your marketo support.
0EM50000000StQZ.jpg

View solution in original post

Anonymous
Not applicable

Re: How do you get access token from identity URL?

That makes sense, thank you.