Hi guys
I created a new GWT project, added the oauth library and wrote the code to
get a token
String AUTH_URL = "https://accounts.google.com/o/oauth2/auth";
String CLIENT_ID = "asdasd"; // available from the APIs console
String TASKS_WRITE_SCOPE = "https://www.googleapis.com/auth/tasks";
AuthRequest req = new AuthRequest(AUTH_URL, CLIENT_ID)
.withScopes(TASKS_WRITE_SCOPE);
Auth.get().login(req, new Callback<String, Throwable>() {
@Override
public void onSuccess(String token) {
// You now have the OAuth2 token needed to sign
authenticated requests.
RootPanel.get().add(new Label("success"));
}
@Override
public void onFailure(Throwable caught) {
// The authentication process failed for some reason, see
caught.getMessage()
RootPanel.get().add(new Label("fail"));
}
});
The first problem i encountered was, that the Callback.class was missing.
Meaning there was no such class in import com.google.gwt.core.client
So i downloaded the class from
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/core/client/Callback.java?spec=svn9872&r=9872and
made the appropriate package.
After this step the errors in eclipse disappeared.
The next problem now is, that when i run my project as web application the
authorization seems to fail. I get a redirect_uri_mismatch.
Now I know that the uri in the google api console has to match but I don't
know how to set the correct url.
If I run my project it runs under
http://127.0.0.1:8888/GoogleTasks.html?gwt.codesvr=127.0.0.1:9997.
I tried to make it run with these uris so far:
- http://127.0.0.1:8888 and http://127.0.0.1:8888/oauth2callback
- http://localhost and http://localhost/oauth2callback
- http://127.0.0.1 and http://127.0.0.1/oauth2callback
All these with no success so far.
Has anyone a tip for me? It's also strange that the Callback.class was not
in the core library of gwt? Or is this all because the oauth library is
still alpha? Should I better do it on my own? Meaning generating the auth
uri by myself?
Thanks in advance, Chris.
redirect_uri_mismatch Error 400
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.