OAuth2: Refreshing token before application starts

Hi guys!

I desperately need help at the moment. I recently changed my app to use OAuth2, but it gives me an access token that I have to update every hour. The problem is that at the start of my application, I need to call the http API to refresh the token BEFORE any other API calls occur. I tried so many different ways to do this, but I can't get it quite right.

I tried to use QEventLoop which is what I found online as a way to QNetworkManager requires synchronous (because it is asynchronous by nature). First of all I tried to do this before creating the QML file...

 QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

But then when I leave the QEventLoop, would not continue on with the rest of the code, I guess because the loop main event starts everything after this line in order to create the QML is called. If entering a QEventThread separated until the thread main event started, I can't to get the refund.

So I tried to do it just after the creation of the QML file via this line above. However, it also doesn't seem to work well because sometimes if the QNetworkReply takes a long time to come back, the QML files already have intiialized and began some other API calls to retrieve the data, without having a valid token to send all they come back as http requests failed them.

Does anyone know a good way to go about this? I need to present this Http request to update my authentication token BEFORE anything else happens, especially before all other calls API occur because otherwise they won't be valid...

Thank you!!

T

Paratheo wrote:

I tried using the delegate class to load the tabs as they are needed, but I ran into issues because originally each tab, I have a NavigationPane. ....

-----

I do the same thing without a problem. See here my Concept of Navigation using TabbedPane as root and NavigationPanes on the top tabs:

Paratheo wrote:

.... The property delegated request a qml source file must have a Page to its root element. I could find a way to maintain my navigationpanes while using the delegate class to dynamically load my tabs. You know a way around this?

You can do this by using delegates - see the code here. (scroll down to "create dynamics and destroy")

Tags: BlackBerry Developers

Similar Questions

  • When I start my PC, and before you start I receive this message from InfoCenter.exe - Application error - the application is not initialate properly (0xc0000135).

    Original title: initialize 0xc0000135

    When I start my PC, and before you start I receive this message from InfoCenter.exe - Application error - the application is not initialate properly (0xc0000135). I just click OK and continue. Any problem? Is this necessary application?

    Walter Rodriguez

    E-mail address is removed from the privacy *.

    10/07/12

    14:57

    Hello

    1. do you receive this after you see Start button or entry?

    2 have you made any changes to the computer before the show?

     

    Method 1: Boot errors are fixed by the clean boot.

    Perform the clean boot and see if that helps.

    A clean boot to check if startup item or services to third-party application is causing this issue.

    Reference: How to solve a problem by performing a clean boot in Windows Vista or Windows 7:

    http://support.Microsoft.com/kb/929135

    Note: when you're done to diagnose, follow step 7 in the article to start on normal startup.

     

    Method 2: Some malware parody itself as InfoCenter.exe, especially when it is located in the folder c:\windows or c:\windows\system32.

    I suggest you make a system full scan just to be sure.

    Here is a link that will give you information on how to perform a full scan of the system:

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    , Note 1: The Microsoft Safety Scanner ends 10 days after being downloaded. To restart a scan with the latest definitions of anti-malware, download and run the Microsoft Safety Scanner again.

    Note 2: The data files that are infected must be cleaned only by removing the file completely, which means that there is a risk of data loss.

  • I'm going to erase my media Cache files before you start a new project, but when I go to/Library/Applications/Common/there is no media Cache folder. I have never had this problem before and am 10.9.5 OS and using clues CS6?

    I'm going to erase my media Cache files before you start a new project, but when I go to/Library/Applications/Common/there is no media Cache folder. I have never had this problem before and am 10.9.5 OS and using clues CS6?

    Hi Dave,.

    The location is ~/Library/Application Support/Adobe/Common to be exact.

    Make sure that you type the TILDE (~) key.

    When in the Finder, click the go > go to folder... > Type ~/Library and navigate to Application Support/Adobe/Common

    Thank you

    Regalo

  • How to run the application startup script before the start of telnet (inetd)

    Hello

    I need to run my application startup script before the beginning of Telnet users on the server. At the present time, the script is at /etc/rc2.d/S98startup which is not useful.

    Thanks in advance...

    Published by: user4027740 on April 7, 2012 12:41

    I am inclined to ask 'why', but I refrain...

    The problem you'll have is that 'telnet' (really inetd) will be started by SMF and your app startup is a legacy script. I don't know of anyway to you allows to map addictive SMF one departure inherited. The only solution is to write a start of SMF for your application and do inetd:default require your application to be online before you start.

  • Events when the application starts

    At the start of my program, I need the user to enter two strings that are then used in the structures of the event. I have created a for this dialog box.

    In addition, if these strings must be changed during execution of the program, I have a button that fires an event value that made up the same dialog to change, then these new values are used through shift to other events registers.

    Is there a way to add a start of application event to the value of the button change event so that the sequence of the program is:

    Open the program

    the dialog box appears

    the user between two strings

    ... the main program using these values...

    the user clicks button changes to the

    the dialog box appears

    the user enters two new channels

    ... the main program using the new values.

    etc...

    Right now I do the first three steps outside the main program loop and there is a value change event that does exactly the same thing in the loop. This doesn't seem to be the most effective way of doing things.

    Kind regards

    Sebster.

    A simple solution is to write to a signaling of the value property of the button before the start of the loop.

    This will be the event queue and fire as soon as the structure of the event is ready to run.

    (To use it, you must create your badge is the switch and put it back to false in the event).

    Here's how it might look:

  • really long delay before rendering starts?

    I have this ongoing problem (CC2014) where there is a long delay before rendering starts. Nothing fancy or heavy, no effect, MacPro/Yosemite/64 GB of ram, made to the internal SSD flash drive. Sometimes I see a 2, 3, 4, 5 minute delay before construction starts, then my comps short and simple, restore in seconds. Just AE text, shape layers and files placed. No business network, no other applications running.

    Any ideas?

    Mike

    If you use multiprocessing, turn it off & see what happens.  If the time-out period goes away, you may need to reassign your processors & memory for multiprocessing in the AE preferences.

    And it never hurts to purge the memory & cache before a final.

  • delay 10s ~ when clicking on links before loading starts

    I have a delay of 10 seconds after clicking on links before loading starts. On some sites, it's worse than on others, the worst being on reddit.com. I tried to reset firefox but that did not help. Thanks in advance for any help.

    Hello

    Try Firefox Safe mode to see if the problem goes away. Firefox Safe mode is a troubleshooting mode that disables some settings and disables most Add-ons (extensions and themes).

    (If you are using an additional theme, place you in default theme.)

    If Firefox is open, you can restart in Mode without failure of Firefox in the Help menu by clicking on the restart with the disabled... modules menu item:

    If Firefox is not running, you can start Firefox in Mode safe mode as follows:

    • On Windows: Hold down the SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac: Hold the option key during the startup of Firefox.
    • On Linux: Exit Firefox, go to your Terminal and run firefox-safe-mode
      (you may need to specify the installation path of Firefox for example/usr/lib/firefox)

    Once you get the pop-up, simply select "" boot mode safe. "

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. Please follow the section Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems to find the cause.

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    When find you what is causing your problems, please let us know. This might help others with the same problem.

    Thank you.

  • Tecra M5 and Debian - need some suggest before you start

    I just bought a new Tecra M5.
    I need to use Debian on it.
    Use some suggest to give me before I start?
    Could I have some problems with comatibility?
    Thank you!

    Perhaps you will be not possible to run tools and look for some drivers.
    Create a backup of your important files before installing Linux. Create a second partition for Linux, then install Linux on that partition. In this case the Linux wouldn t have a bad influence on the first partition and windows OS.
    If something goes wrong, you can always delete the second partition Linux.

  • How do I know if a VI is already running before calling Start Asynchronous Call?

    The new node to start the asynchronous call is great for the spawning of several instances of the reentrant vis.  However, I fell a little bit using for screws not reentrant the old practice of using the method "Run a VI" would allow us to check the Execution.State of the VI before calling the method to execute.  This way if the State was running or running at a higher level, we could spend the invoke node and just use a property node to open the front panel.  With the starting node the asynchronous call, it seems that we must use a strictly typed static VI reference, and when we open the reference VI, VI gets booked and his Execution.State = running.  So, how whether it is not only reserved by wire, but actually running before calling Start redundant?

    Moreover, the redundant beginning has an interesting behavior.  Actually, it will cause the targeted VI must be performed again after it stops.  Even if you tap the Abort button on the target VI, it run immediately still and always the same number of times as the starting node the asynchronous call is executed.  There is nothing wrong with that, and I guess the simple answer is to simply go back to the old method of "run a VI.  It's just that ability over these inputs directly to the connector pane is so nice.  Maybe missing me something obvious.  Oh, I am referring to the call and forget mode (0x80).

    Thank you

    Dan

    Maybe missing me something obvious.  Oh, I am referring to the call and forget mode (0x80).

    Yes you have forgotten that he forgets the Run method always seems to be a better choice for this mode

  • the upgrade of windows 8 at 81, will be hp support assistant update drivers before you start

    I recently bought fancy m7 j020dx 17 running windows 8, I thought it would make more snse upgrade to windows 8.1 before I install other software and other.  It's not not clear to me if hp support assistant will detect if the drivers I have are all of this to date.  can anyone tell me for sure?  Thank you!

    KevinOr

    Do not use HPSA to 8.1 Windows Installer driver, many system had an accident with the update of the Bios on HPSA

    Download the Bios and the driver manual

    before you start the windows 8.1 update

    Uninstall the Virusscanner and install the new Bios

    http://ftp.HP.com/pub/SoftPaq/sp64501-65000/sp65000.exe

    Download the other drivers from here

    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=4158&LC=en&cc=us&DLC=en&sw_lang=&product=5447327#N2074

    If you have a problem after installation

    Delete restart driver Intel HD and install the new

    Read the instructions of Windows 8 to 8.1

    http://support.HP.com/us-en/document/c03847367

  • HP Pavilion Notebook 15-ab083T: laptop upgraded before even starting for the first time = problem?

    Hello!

    I recently bought this laptop with the intention to replace the hard drive (1 TB HDD 120 GB SSD), as well as upgrading the ram from 8 GB to 16 GB. The problem is that I have improved these things before you start for the first time. And now it complains that it cannot find a device boot, even when I insert a USB key with windows 10 iso on it. Or a cd with windows XP. He needs to have the HDD windows 8.1 original in it on first commissioning? It took a while to replace parts...

    Thanks in advance.

    That's very true, I used gparted before checking this again, and it was corrupted. Very well! I ended up installing windows 10 home using a free student license. It's perfect, since I have windows 8.1 before running on the 1 TB hard drive and it was filled with bloatware, thanks to HP (no offense). So, it is nice to have a clean install. Everything works fine now, I had to change some settings of 'Legacy Boot' in the bios to boot from the USB.

  • the logo of computers manufactures, before windows starts. How is - put it on screen

    the logo of the factory, before windows starts. Hence is it from inside the system? drolnoraa

    Well, if you have a motherboard Intel boot logo & other

    the items can be modified. Try intel.com, search of the Integrator 'Intel' utility, they

    have to versions, it's also free without limitation in time.

  • problem starting before windows starts

    Hello world

    Recently I bought HP Z220 Convertible Minitowers Workstation which is more than good. Windows starts in 20 seconds. What worries me is that when I bought the computer, the startup procedure was really fast. After a some time during the early (before windows starts) appeared onscreen HP saying "Press any key to Option ROM Messages and ESC to enter the configuration menu". It's really annoying because it is there for 1 minute and then the operating system starts.

    I tried to change in the first menu via the shortcut CTRL + S, but without success. When I clicked on disable, it's just gone, and now I can not ge it most.

    Then I entered in the BIOS and in advanced option, I have managed to disable ROM prompt messages. This one missing at the start, but the second saying "Press ESC to enter the menu setup" is still there. I'm worried that if I disable it, I won't be able to return to the menu setup.

    Is there a possibility to reset these startup options? Restore the default values in the BIOS did not help.

    Thank you

    Joe

    Hello Snakey100,

    Welcome to the forums.

    Your system is one of our business models.

    Your question will be better answered it on our business forums.

    Here is a link to the forums.

  • Download Itunes on my laptop just before, it starts to install, I get a message saying that windows Explorer stops because the prevention of execution of data has stopped installation

    original title: Itunes and DEP

    While downloading Itunes on my laptop right before you start to install, I get a message saying that windows Explorer stops because the prevention of execution of data has stopped installation.  Is there any solution for this?  I'd like to install itunes on my laptop.

    Hi Steve681229,

    Thank you for using the Microsoft Answers forum.  Here's what worked for someone else.  Thanks Kevin

    Hi thrivenformore,

    Please use the forum for Support of Vista,

    You could try to add iTunes to the DEP exception list.  However, this behavior is not normal.  Go to the support forum of Apple for iTunes for Windows, search on DEP.  There should be a thread "How can I turn off DEP for iTunes?" or it Prevet planting iTunes? "which provide troubleshooting steps you might want to try before adding it to the list of exceptions."

    How to add the program to the DEP exception list:

    1. Press Start, right click on computer and select Properties.
    2. in the window that appears, click Advanced (on the left panel) system settings.
    3. in the first box that says Performance, click on the settings button.
    4. in the window that opens, click the Data Execution Prevention tab at the top.
    5. There should be a box of exceptions in the middle of this window. Click the Add button and navigate to the C: drive, then Program Files, then the iTunes folder, and then choose the iTunes exe.
    6. Add the exception, and then click OK in the window of the DEP.

    Hope this helps, Kevin
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    Thank you for using answers Forum. Please let us know how it works.

    Joseph
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Vista System Restore does not work. I disable Norton Antivirus before you start the process. What can I do else?

    Vista System Restore does not work. I disable Norton Antivirus before you start the process. What can I do else?

    1. try SR in safe mode:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    2 Malware will stop at the system restore:

    If necessary, do all the work Safe Mode with network.

     

    To get into Safe Mode with network, press F8 at the Power On / boot and use key arrow upward to get into SafeMode with networking from the list of options, and then press ENTER.

    http://www.Malwarebytes.org/MBAM.php

    Malwarebytes is as its name suggests, a Malware Remover!

    Download the free Version from the link above.

    Download, install, upgrade and scan once a fortnight.

    See you soon.

    Mick Murphy - Microsoft partner

Maybe you are looking for

  • How to put in El Capitan Yosemite?

    I use Mac OS X 10.10 and upgrade to Mac OS X 10.11 (El Capitan). How can I get a copy of it. All of my software work are compatible with it, no Sierra. If I update to Sierra many programs won't work, such as Pro Tools and other music software. Help,

  • Why WhatsApp is not a standard application on iOS iPad 3 9.2?

    Why WhatsApp is not a standard application on iOS iPad 3 9.2? Or indeed any iPad! WhatsApp is the most used social network App in the world! And why clients unable to use their SIM cards for calling and messaging?

  • installing the new hard drive...

    I have a HP Pavilion a1400e Desktop PC supplied with Windows XP 32 bit preinstalled, I want to replace my current hard drive provided with the desktop computer, but I don't know how big can manipulate the computer... did someone know or point me in t

  • Apple TV 4 Audio pass through

    Hi- My current setup is: 4 AppleTV via HDMI-> Onkyo HT-R990 7.1THX via HDMI-> Samsung Smart TV 60 inch LED. The TV speakers are turned off and that all the sound elements through my 7.1 System. My question is about how to disable the audio decoding o

  • Banner or continuous form printing

    I want to print my family tree of descent using my AIO printers: officeJet Pro 8500 A910 (purchased on 01/06/11) OfficeJet Pro 8600 N911A (purchased on 01/06/13) Is there a driver to use to print banners or either of these printers?