Skip to content

Instantly share code, notes, and snippets.

View yathindrak's full-sized avatar
🎯
Focusing

Yathindra Kodithuwakku yathindrak

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am yathindrak on github.
  • I am yathindra (https://keybase.io/yathindra) on keybase.
  • I have a public key ASAeXIU8Uk8RvsDb5ezGm5F-NWZWATe4fx8Lm2w2V4N0YAo

To claim this, I am signing this object:

let oldXHROpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.send = function() {
this.addEventListener("send", function() {
const responseBody = this.responseText;
console.log(`Response Body: ${responseBody}`);
});
return oldXHROpen.apply(this, arguments);
};
const { state, signIn, signOut } = useAuthContext();
.....
{
state?.isAuthenticated ?
(
<button
className="inline-flex items-center justify-center h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md bg-deep-purple-accent-400 hover:bg-deep-purple-accent-700 focus:shadow-outline focus:outline-none"
aria-label="Sign up"
import React, { ReactNode } from "react";
import { AuthProvider } from "@asgardeo/auth-react";
import useSiteMetadata from "../hooks/useSiteMetaData";
import "../styles/global.css";
interface Props {
children?: ReactNode;
}
const PageLayout = ({ children }: Props) => {
import React from "react";
import PageLayout from "./src/components/layout";
export const wrapRootElement = ({ element }) => {
return (
<>
<PageLayout>
{element}
</PageLayout>
</>
@yathindrak
yathindrak / _app.js
Created February 5, 2022 10:46
NextAuth Provider
import { NavBar } from '../components/NavBar'
import { SessionProvider } from "next-auth/react"
import '../styles/globals.css'
function MyApp({ Component, pageProps }) {
return (
<SessionProvider session={pageProps?.session}>
<NavBar />
<Component {...pageProps} />
</SessionProvider>
@yathindrak
yathindrak / [...nextauth].js
Last active April 11, 2022 15:38
Custom asgardeo next-auth provider
import NextAuth from "next-auth"
export default NextAuth({
providers: [
{
id: "asgardeo",
name: "Asgardeo",
type: "oauth",
clientId: process.env.ASGARDEO_CLIENT_ID,
clientSecret: process.env.ASGARDEO_CLIENT_SECRET,