<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Java desktop DbxWebAuth with withRedirectUri NPE in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/m-p/411576#M22252</link>
    <description>&lt;P&gt;Hi everyone, as I wrote in the object, I get an NPE on the line:&lt;/P&gt;
&lt;PRE&gt; HttpSession session = request.getSession(true);&lt;/PRE&gt;
&lt;P&gt;Hi everyone, as I wrote in the object, I get an NPE on the line:&lt;/P&gt;
&lt;P&gt;I'm using this code to prevent the user from manually entering the verification code into my app. from the example codes I found HttpServletRequest is not initialized (null). Do you have any examples examples? Thank you&lt;BR /&gt;This is the complete code&lt;/P&gt;
&lt;PRE&gt;public static void main(String[] args) throws DbxException, IOException, URISyntaxException {

        HttpServletRequest request = null;
        HttpServletResponse response = null;

        DbxRequestConfig config = new DbxRequestConfig("berry120_dropbox_example"); //Client name can be whatever you like

        DbxAppInfo appInfo = new DbxAppInfo("my_code", "my_code");
        DbxWebAuth webAuth = new DbxWebAuth(config, appInfo);

        //redirect URL 
        String redirectUri = "http://localhost:8080";
        HttpSession session = request.getSession(true);

        DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, "vj38b0mkkxnnbjg");

        DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
                .withRedirectUri(redirectUri, csrfTokenStore)
                .build();

        String authorizePageUrl = webAuth.authorize(authRequest);
        try {
            response.sendRedirect(authorizePageUrl);

        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Apr 2020 06:52:18 GMT</pubDate>
    <dc:creator>ChriCC</dc:creator>
    <dc:date>2020-04-20T06:52:18Z</dc:date>
    <item>
      <title>Java desktop DbxWebAuth with withRedirectUri NPE</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/m-p/411576#M22252</link>
      <description>&lt;P&gt;Hi everyone, as I wrote in the object, I get an NPE on the line:&lt;/P&gt;
&lt;PRE&gt; HttpSession session = request.getSession(true);&lt;/PRE&gt;
&lt;P&gt;Hi everyone, as I wrote in the object, I get an NPE on the line:&lt;/P&gt;
&lt;P&gt;I'm using this code to prevent the user from manually entering the verification code into my app. from the example codes I found HttpServletRequest is not initialized (null). Do you have any examples examples? Thank you&lt;BR /&gt;This is the complete code&lt;/P&gt;
&lt;PRE&gt;public static void main(String[] args) throws DbxException, IOException, URISyntaxException {

        HttpServletRequest request = null;
        HttpServletResponse response = null;

        DbxRequestConfig config = new DbxRequestConfig("berry120_dropbox_example"); //Client name can be whatever you like

        DbxAppInfo appInfo = new DbxAppInfo("my_code", "my_code");
        DbxWebAuth webAuth = new DbxWebAuth(config, appInfo);

        //redirect URL 
        String redirectUri = "http://localhost:8080";
        HttpSession session = request.getSession(true);

        DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, "vj38b0mkkxnnbjg");

        DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
                .withRedirectUri(redirectUri, csrfTokenStore)
                .build();

        String authorizePageUrl = webAuth.authorize(authRequest);
        try {
            response.sendRedirect(authorizePageUrl);

        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Apr 2020 06:52:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/m-p/411576#M22252</guid>
      <dc:creator>ChriCC</dc:creator>
      <dc:date>2020-04-20T06:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Java desktop DbxWebAuth with withRedirectUri NPE</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/m-p/412158#M22266</link>
      <description>&lt;P&gt;[ Cross-linking for reference:&amp;nbsp;&lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/td-p/411576" target="_blank"&gt;https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/td-p/411576&lt;/A&gt;&amp;nbsp;]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This&amp;nbsp;DbxWebAuth flow is meant for use with web apps, via whatever web framework you might be using. The request and response objects in this basic sample initially aren't set, and instead are just&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;null as a placeholder. Without setting them,&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;the NPE is expected.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;We do have a working example with these set here:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/c710ef80f1c2700031baad7c615dc9934162c090/examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/DropboxAuth.java" target="_blank"&gt;https://github.com/dropbox/dropbox-sdk-java/blob/c710ef80f1c2700031baad7c615dc9934162c090/examples/web-file-browser/src/main/java/com/dropbox/core/examples/web_file_browser/DropboxAuth.java&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Apr 2020 15:52:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Java-desktop-DbxWebAuth-with-withRedirectUri-NPE/m-p/412158#M22266</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-04-20T15:52:34Z</dc:date>
    </item>
  </channel>
</rss>

