概要

Nuxt3と@sidebase/nuxt-authを使って、Drupalの認証を行う方法です。

背景

以下の記事で、GakuNin RDMの認証を行う方法を紹介しました。

また、以下の記事で、Next.jsからDrupalのOAuthを利用する方法を紹介しました。

これらを参考にして、Nuxt3からDrupalのOAuthを利用します。

方法

ソースコードは以下のリポジトリでご確認いただけます。

https://github.com/nakamura196/nuxt-rdm

具体的には、以下です。

https://github.com/nakamura196/nuxt-rdm/blob/main/server/api/auth/[…].ts

{},intcca}t}p}dayllu,o,r,:mpiitup}ka}or}eeeehra,es,fe;"::nnolrsrr}nyc}c}ci}ritineidttr:acee/:no)o)ofeludammr""ISimosduacncccgr};nmh}b;ntter:maauDodezpsppisp{sllore/see,os(hu(neigpra:car:eoreirtiidaduatta"dt!rrpp:leauurto:neR/eeeenisphdCyronr{r::lptueic{scuaqbnn:treiroeo,jewoop"ahstoepetnuuott_eR/edrnss{ffrpp,l"e:nsr__tted__ctcuas:sto.niiorr",R:sotuihsyisoytnu:enoetllfoo,uu.cyrm/tdenp_tt="nkwoeeiffns{eepiec(=:cteuihP{t=)k).liitense:Cacre:rm/aO-EeselliRvs:olonuexiecwSTa{rn{u.eemu..`nlnestt":CaaTywrsbn..enDe"$fbtwe:.aoli"pao:,aepCtRnc{iaeRpu`nlt,eirmmroiUvogcxUuuat$fb"t(jeaonmP.d(ktRnsrh{iaf:`siffeADe))LteaogcerToliiCLR".dSiRmr(kt"eon"lgo_U,nr{emusi)caskse(nAPeuaen.z.dhp.e}up)fUAxprCtcanr(pjn;br.iTLtacoioteupls"o"dgH_AlhnmdixpriorfNr(_Su`Pfeeotaocneionu)UCt,aiCnAlca(qlup.ROhrg_u`et)ueEladLPUa(nct,si;e.mllr,Erm)fohsospa,Cu,ls.i"dU.ntrilp(dg"ere/elia{r(,"lnxffelu),v-PaePnCp..waiIrrtladDwrlDroIilrRwseevdeCuU-eddi,nlpPf:_dtiaAotueSelLrh$sdUenC_me{e"RctlT-rr,LrIiOurenedeKresat,nEls.m,tNepseS_noteUcnacRost使rLdeuees"tdbTU,"oen,dxk"ytn"}o,o`wn)n調{c;eUser",

まとめ

間違っている点もあるかもしれませんが、参考になりましたら幸いです。