1"use strict";(globalThis.webpackChunksimple_jwt_login_website=globalThis.webpackChunksimple_jwt_login_website||[]).push([[5223],{60945(e,t,n){n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>h,frontMatter:()=>r,metadata:()=>i,toc:()=>c});const i=JSON.parse('{"id":"integrations/Google/id_token_to_JWT","title":"Exchange id_token with a WordPress JWT","description":"Overview","source":"@site/versioned_docs/version-3.0.0/integrations/Google/04_id_token_to_JWT.mdx","sourceDirName":"integrations/Google","slug":"/applications/google/id_token_to_wp_jwt/","permalink":"/docs/3.0.0/applications/google/id_token_to_wp_jwt/","draft":false,"unlisted":false,"editUrl":"https://github.com/simple-jwt-login/website/tree/main/versioned_docs/version-3.0.0/integrations/Google/04_id_token_to_JWT.mdx","tags":[],"version":"3.0.0","sidebarPosition":4,"frontMatter":{"slug":"/applications/google/id_token_to_wp_jwt/","title":"Exchange id_token with a WordPress JWT","sidebar_position":4,"author":"Nicu Micle","author_url":"https://github.com/nicumicle"},"sidebar":"tutorialSidebar","previous":{"title":"Exchange OAuth Code with Google ID Token","permalink":"/docs/3.0.0/applications/google/oauth_code/"},"next":{"title":"Shortcode","permalink":"/docs/3.0.0/applications/google/shortcode/"}}');var o=n(74848),s=n(28453);n(90695);const r={slug:"/applications/google/id_token_to_wp_jwt/",title:"Exchange id_token with a WordPress JWT",sidebar_position:4,author:"Nicu Micle",author_url:"https://github.com/nicumicle"},l=void 0,d={},c=[{value:"Overview",id:"overview",level:2},{value:"Endpoint",id:"endpoint",level:2},{value:"Request Example",id:"request-example",level:2},{value:"SHELL",id:"shell",level:3},{value:"Example Response",id:"example-response",level:2},{value:"Success",id:"success",level:3},{value:"Error",id:"error",level:3}];function a(e){const t={admonition:"admonition",code:"code",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(t.h2,{id:"overview",children:"Overview"}),"\n",(0,o.jsx)(t.p,{children:"The Exchange OAuth Code with Google ID Token route in Simple JWT Login enables the exchange of the OAuth code obtained during the OAuth flow with a Google ID Token. This process facilitates secure user authentication and authorization with Google services. Below are the parameters and details required for this operation."}),"\n",(0,o.jsxs)(t.p,{children:["This can be used when the OAuth process is happening in a different APP, and you need to obtain the ",(0,o.jsx)(t.code,{children:"access_token"})," or the ",(0,o.jsx)(t.code,{children:"id_token"}),"."]}),"\n",(0,o.jsx)(t.admonition,{type:"note",children:(0,o.jsxs)(t.p,{children:["To ensure a smooth process, it's crucial to use the identical ",(0,o.jsx)(t.code,{children:"redirect_uri"})," in WordPress as the one utilized in the OAuth flow."]})}),"\n",(0,o.jsx)(t.h2,{id:"endpoint",children:"Endpoint"}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"METHOD"}),": ",(0,o.jsx)(t.code,{children:"POST"})]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"ENDPOINT"}),": ",(0,o.jsx)(t.code,{children:"/simple-jwt-login/v1/oauth/token"})]}),"\n",(0,o.jsxs)(t.p,{children:[(0,o.jsx)(t.strong,{children:"URL Example"}),": ",(0,o.jsx)(t.code,{children:"https://{{yoursite}}/?rest_route=/simple-jwt-login/v1/oauth/token&provider=google&code={{code}}"})]}),"\n",(0,o.jsxs)(t.table,{children:[(0,o.jsx)(t.thead,{children:(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.th,{style:{textAlign:"center"},children:"Parameter"}),(0,o.jsx)(t.th,{style:{textAlign:"center"},children:"Type"}),(0,o.jsx)(t.th,{children:"Description"})]})}),(0,o.jsxs)(t.tbody,{children:[(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{style:{textAlign:"center"},children:"provider"}),(0,o.jsxs)(t.td,{style:{textAlign:"center"},children:[(0,o.jsx)(t.code,{children:"required"})," ",(0,o.jsx)(t.code,{children:"string"})]}),(0,o.jsx)(t.td,{children:"Specifies the identity provider. Set this parameter to 'google'."})]}),(0,o.jsxs)(t.tr,{children:[(0,o.jsx)(t.td,{style:{textAlign:"center"},children:"id_token"}),(0,o.jsxs)(t.td,{style:{textAlign:"center"},children:[(0,o.jsx)(t.code,{children:"required"})," ",(0,o.jsx)(t.code,{children:"string"})]}),(0,o.jsxs)(t.td,{children:["The OAuth ",(0,o.jsx)(t.code,{children:"id_token"})," obtained from the OAuth flow."]})]})]})]}),"\n",(0,o.jsx)(t.h2,{id:"request-example",children:"Request Example"}),"\n",(0,o.jsx)(t.h3,{id:"shell",children:"SHELL"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-bash",children:"curl -X POST 'https://simplejwtlogin.com/?rest_route=/simple-jwt-login/v1/oauth/token&provider=google&id_token={{id_token}}'\n"})}),"\n",(0,o.jsx)(t.h2,{id:"example-response",children:"Example Response"}),"\n",(0,o.jsx)(t.h3,{id:"success",children:"Success"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json",children:'{\n "success": true,\n "data" : {\n "jwt": "simplejwtlogin jwt here"\n }\n}\n'})}),"\n",(0,o.jsx)(t.h3,{id:"error",children:"Error"}),"\n",(0,o.jsx)(t.pre,{children:(0,o.jsx)(t.code,{className:"language-json",children:'{\n "success": false,\n "data": {\n "message": "The code or jwt parameter is missing from request.",\n "errorCode": 71\n }\n}\n'})})]})}function h(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},90695(e,t,n){n.d(t,{A:()=>i});const i={textCenter:"textCenter_rXyj",btn:"btn_IxfZ"}},28453(e,t,n){n.d(t,{R:()=>r,x:()=>l});var i=n(96540);const o={},s=i.createContext(o);function r(e){const t=i.useContext(s);return i.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),i.createElement(s.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.