1"use strict";(self.webpackChunkinappweview_website=self.webpackChunkinappweview_website||[]).push([["321"],{6999:function(e,t,a){a.r(t),a.d(t,{metadata:()=>n,contentTitle:()=>c,default:()=>h,assets:()=>l,toc:()=>p,frontMatter:()=>d});var n=JSON.parse('{"id":"http-auth-credential-database","title":"Http Auth Credential Database","description":"<SupportedPlatforms","source":"@site/docs/http-auth-credential-database.mdx","sourceDirName":".","slug":"/http-auth-credential-database","permalink":"/docs/http-auth-credential-database","draft":false,"unlisted":false,"editUrl":"https://github.com/pichillilorenzo/inappwebview.dev/tree/main/docs/http-auth-credential-database.mdx","tags":[],"version":"current","sidebarPosition":7,"frontMatter":{"sidebar_position":7,"date":"2022-10-12T12:00:00.000Z"},"sidebar":"tutorialSidebar","previous":{"title":"Cookie Manager","permalink":"/docs/cookie-manager"},"next":{"title":"Web Storage Manager","permalink":"/docs/web-storage-manager"}}'),i=a("5893"),r=a("65"),s=a("7360"),o=a("5479");let d={sidebar_position:7,date:new Date("2022-10-12T12:00:00.000Z")},c="Http Auth Credential Database",l={},p=[{value:"Basic Usage",id:"basic-usage",level:2}];function u(e){let t={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,r.a)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"http-auth-credential-database",children:"Http Auth Credential Database"})}),"\n",(0,i.jsx)(o.j,{platforms:[s.t.Android,s.t.iOS,s.t.macOS]}),"\n",(0,i.jsxs)(t.p,{children:["To manage HTTP auth credentials, you can use the ",(0,i.jsx)(t.code,{children:"HttpAuthCredentialDatabase"})," class, which implements a singleton object (shared instance)."]}),"\n",(0,i.jsxs)(t.p,{children:["On iOS and macOS, this class uses the ",(0,i.jsx)(t.a,{href:"https://developer.apple.com/documentation/foundation/urlcredentialstorage",children:"URLCredentialStorage"})," class. On Android, this class has a custom implementation using ",(0,i.jsx)(t.code,{children:"android.database.sqlite.SQLiteDatabase"})," because the ",(0,i.jsx)(t.a,{href:"https://developer.android.com/reference/android/webkit/WebViewDatabase",children:"WebViewDatabase"})," class doesn't offer the same functionalities as iOS ",(0,i.jsx)(t.code,{children:"URLCredentialStorage"}),"."]}),"\n",(0,i.jsx)(t.h2,{id:"basic-usage",children:"Basic Usage"}),"\n",(0,i.jsx)(t.p,{children:"Here is an example of how to set a HTTP auth credential for a particular Protection Space:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-dart",children:'// get the HttpAuthCredentialDatabase instance\nHttpAuthCredentialDatabase httpAuthCredentialDatabase =\n HttpAuthCredentialDatabase.instance();\n\n// set a HTTP auth credential for a particular Protection Space\nhttpAuthCredentialDatabase.setHttpAuthCredential(\n protectionSpace: URLProtectionSpace(\n host: "example.com",\n protocol: "http",\n realm: "Realm",\n port: 8081),\n credential:\n URLCredential(username: "USERNAME", password: "PASSWORD"));\n'})})]})}function h(e={}){let{wrapper:t}={...(0,r.a)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(u,{...e})}):u(e)}},7360:function(e,t,a){a.d(t,{t:function(){return i}});var n,i=((n={}).Android="Android",n.iOS="iOS",n.macOS="macOS",n.Windows="Windows",n.Linux="Linux",n.Web="Web",n)},5479:function(e,t,a){a.d(t,{j:()=>r});var n=a("5893");a("7294");let i=e=>{let{text:t,type:a="info"}=e;return(0,n.jsx)("span",{className:"badge badge--"+a,style:{lineHeight:"initial"},children:t})},r=e=>{let{platforms:t}=e;return(0,n.jsxs)("p",{style:{display:"flex",flexDirection:"row",gap:"5px"},children:[(0,n.jsx)("strong",{children:"Supported Platforms: "}),t.map((e,t)=>{let a="object"==typeof e?e:null;return(0,n.jsx)(i,{text:"string"==typeof e?e:`${a.platform} ${a.version?a.version+"+":""}`.trim()},t)})]})}},65:function(e,t,a){a.d(t,{Z:function(){return o},a:function(){return s}});var n=a(7294);let i={},r=n.createContext(i);function s(e){let t=n.useContext(r);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.