Hi,
Thanks for the reply.
The problem is that piece of code will give me the URL that redirects to the instagram log in.
The URL that I want is the one that the user is redirected to AFTER they log in.
How is the Instagram implemented in your App?
Are you handling sending the user data yourself, is it an Embedded Browser Component or maybe using Page.open(Url)?
getUI().getPage().open(authorizationUrl, "_blank");
Not sure if this is what you wanted to know, but I have edited my first post with my code, which should be able to answer your question.
Is the user returned to your Vaadin app after logging in? If yes, does he get a new UI instance or the old one? What is the URL of your Vaadin app when the user returns?
Currently I am opening the redirect url that provides the code in a new browser window (e.g.www.freehost.com/?code=123456789) and the user has to copy this code from the url and paste it into the text box.
All URL parameters can be read through the VaadinRequest. If you have the same UI instance, then the init() method won’t be called again. If you are using Vaadin 7.2, then you can override the refresh method from the UI. Refresh will also get the VaadinRequest and from there you should be able to get the code, in case it is as a URL parameter to your app upon returning from the login.
Thanks for the help, but Im sorry I dont really understand how to go about doing that as I am quite new to Vaadin.
Is there anywhere that I can see an example of what you just said?
Thanks again!
@Kim: I think you might not understand the OP’s case fully. As far as i understand it the Instagram Login is happening in a seperate Popup Window (or Tab). The Url changes only happen inside that window and not in the Vaadin App’s Url. That’s why i don’t think you’ll be able to capture a request containing those parameters or even get the event of closing the new Window/Tab.
I’m a bit out of ideas here too. I also don’t really have time to think about it. There are currently only 2 things coming to my mind:
First: Maybe using an IFrame and native Javascript you may have better control about the Url changes inside the frame then using Page.open or an Embedded.
Second: Maybe there is a way to get these parameters by doing the Login manually (probably needs an interface made by Instagram though) and then just send an ajax call to the Instagram Server returning the Code Parameter.