Overview This describes how to authenticate with Drupal using Nuxt 3 and @sidebase/nuxt-auth.
Background The following article introduced a method for authenticating with GakuNin RDM.
The following article introduced a method for using Drupal OAuth from Next.js.
Using these as reference, we use Drupal OAuth from Nuxt 3.
Method The source code can be found in the following repository.
https://github.com/nakamura196/nuxt-rdm
Specifically, the implementation is here.
https://github.com/nakamura196/nuxt-rdm/blob/main/server/api/auth/[…].ts
{ } , i n t c c a } t } p } d a y l l u , o , r , : m p i i t u p } k a } o r } e e e e h r a , e s , f e ; " : : n n o l r s r r } n y c } c } c i } r i t i n e i d t t r : a c e e / : n o ) o ) o f e l u d a m m r " " I S i m o s d u a c n c c c g r } ; n m h } b ; n t t e r : m a a u D o d e z p s p p i s p { s l l o r e / s e e , o s ( h u ( n e i g p r a : c a r : e o r e i r t i i d a d u a t t a " d t ! r r p p : l e a u u r t o : n e R / e e e e n i s p h d C y r o n r { r : : l p t u e i c { s c u a q b n n : t r e i r o e o , j e w o o p " a h s t o e p e t n u u o t t _ e R / e d r n s s { f f r p p , l " e : n s r _ _ t t e d _ _ c t c u a s : s t o . n i i o r r " , R : s o t u i h s y i s o y t n u : e n o e t l l f o o , u u . c y r m / t d e n p _ t t = " n k w o e e i f f n s { e e p i e c ( = : c t e u i h P { t = ) k ) . l i i t e n s e : C a c r e : r m / a O - E e s e l l i R v s : o l o n u e x i e c w S T a { r n { u . e e m u . . ` n l n e s t t " : C a a T y w r s b n . . e n D e " $ f b t w e : . a o l i " p a o : , a e p C t R n c { i a e R p u ` n l t , e i r m m r o i U v o g c x U u u a t $ f b " t ( j e a o n m P . d ( k t R n s r h { i a f : ` s i f f e A D e ) ) L t e a o g c e r T o l i i C L R " . d S i R m r ( k t " e o n U l g o _ U , n r { e m u s i ) c a s k s e ( n A P e u a e n . z . d h p . e } e p ) f U A x p r C t c a n r ( p j n ; r . i T L t a c o i o t e u p l s " o " d g H _ A l h n m d i x p r i o r s f N r ( _ S u ` P f e e o t a o c n e u i o n u ) U C t , a i C n A l c a ( q b l u p . R O h r g _ u ` e t ) u " e E l a d L P U a ( n c t , s i ; e . m l l r , E r m ) f o h s o s a p a , C u , l s . i " d U . n t s r i l p ( d g " e r e / e l i a { r ( , " l n x f t f e l u ) , v - P a h e P n C p . . w a i e r r U t l a d D w r l r o s I i l r R w s e u e v e d e C u U - e d s d i , n l p P f : e _ d p t i a A o t r u e r S e l L r h $ ' s d o e n C _ m e { s e " f c t l T - r r , i r I i O u r e u n l e d e K r e s n a e t , n E l s . i m , t N e p s q e U S _ n o t u F R e U c n a e a L c R o s t l r L d e u I l a e e s D " b s t d b T U a , " o e n c i , d x k k m " y t n a " } o w g , o ` w h e n ) n e { c ; n ( e U a s n d e o j r u " e s , m t a i a l s S n e e t e d n e a d m ) e p r i o r i t y Summary There may be some errors, but I hope this serves as a helpful reference.
...