Asif
Asif
PD🧩 Plasmo Developers
Created by Asif on 3/17/2024 in #👟framework
Tab page injecting CSS into website's runtime
@lab can you help me with it?
3 replies
PD🧩 Plasmo Developers
Created by Asif on 2/26/2024 in #👟framework
Rendering issue on single page application (SPA) like youtube
@kvnfo Custom rendering might be a solution. But in youtube, some issue happened when reached to home page
5 replies
PD🧩 Plasmo Developers
Created by Asif on 2/26/2024 in #👟framework
Rendering issue on single page application (SPA) like youtube
@louis please help to solve this issue
5 replies
PD🧩 Plasmo Developers
Created by Asif on 11/10/2023 in #👾extension
How send message from background to content script UI
Thanks. One more question. MAIN world is necessary to acheive pub/sub?
13 replies
PD🧩 Plasmo Developers
Created by Asif on 11/10/2023 in #👾extension
How send message from background to content script UI
Can you give me a simple code example of the current scenario?
13 replies
PD🧩 Plasmo Developers
Created by Asif on 11/10/2023 in #👾extension
How send message from background to content script UI
No
13 replies
PD🧩 Plasmo Developers
Created by Asif on 1/3/2024 in #👟framework
Google & Facebook OAuth without firebase
@McJezus got it. thanks. i will try this approach
15 replies
PD🧩 Plasmo Developers
Created by Asif on 1/3/2024 in #👟framework
Google & Facebook OAuth without firebase
@McJezus is the handleOAuthLogin function in your content ui? and can you show me your OAuthLogin?
15 replies
PD🧩 Plasmo Developers
Created by Asif on 11/10/2023 in #👾extension
How send message from background to content script UI
@louis can you help me with this?
13 replies
PD🧩 Plasmo Developers
Created by Asif on 1/3/2024 in #👟framework
Google & Facebook OAuth without firebase
@McJezus I am using chrome. Can you share what you did?
15 replies
PD🧩 Plasmo Developers
Created by AB7zz on 9/5/2023 in #👾extension
How do I message from background to my content script?
@AB7zz sure. Native messaging is not working here. Plasmo messaging system is working fine. If i use this in my content script or anywhere chrome.runtime.onMessage.addListener(function (message) { console.log("details message", message) }) I found this error Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist. Can you help me to use native messaging system
18 replies
PD🧩 Plasmo Developers
Created by Asif on 1/3/2024 in #👟framework
Google & Facebook OAuth without firebase
I have implemented google oauth by calling the endpoint direct in my background. Like this:
const clientId = encodeURIComponent(process.env.PLASMO_PUBLIC_GOOGLE_CLIENT_ID)
const responseType = encodeURIComponent("token id_token")
const redirecturi = encodeURIComponent(
`https://${process.env.PLASMO_PUBLIC_EXTENSION_ID}.chromiumapp.org`
)
const prompt = encodeURIComponent("consent")
const scope = encodeURIComponent("openid profile email")
const state = encodeURIComponent("pass-through value")

const createOauth2Url = () => {
const nonce = encodeURIComponent(
Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15)
)

const requesturl = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${clientId}&response_type=${responseType}&redirect_uri=${redirecturi}&scope=${scope}&prompt=${prompt}&state=${state}&nonce=${nonce}`

return requesturl
}

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const callbackurl = await chrome.identity.launchWebAuthFlow({
url: createOauth2Url(),
interactive: true
})

console.log("Getting started soon...")

const searchParams = new URLSearchParams(callbackurl.split("#")[1])
const accessToken = searchParams.get("access_token")
const idToken = searchParams.get("id_token")

const tokenResponse = await fetch(
`https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${idToken}`
)

if (!tokenResponse.ok) {
res.send({
signedIn: isSignedin,
message: "Error when getting user"
})
return
}

const userInfo = await tokenResponse.json()

}
const clientId = encodeURIComponent(process.env.PLASMO_PUBLIC_GOOGLE_CLIENT_ID)
const responseType = encodeURIComponent("token id_token")
const redirecturi = encodeURIComponent(
`https://${process.env.PLASMO_PUBLIC_EXTENSION_ID}.chromiumapp.org`
)
const prompt = encodeURIComponent("consent")
const scope = encodeURIComponent("openid profile email")
const state = encodeURIComponent("pass-through value")

const createOauth2Url = () => {
const nonce = encodeURIComponent(
Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15)
)

const requesturl = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${clientId}&response_type=${responseType}&redirect_uri=${redirecturi}&scope=${scope}&prompt=${prompt}&state=${state}&nonce=${nonce}`

return requesturl
}

const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
const callbackurl = await chrome.identity.launchWebAuthFlow({
url: createOauth2Url(),
interactive: true
})

console.log("Getting started soon...")

const searchParams = new URLSearchParams(callbackurl.split("#")[1])
const accessToken = searchParams.get("access_token")
const idToken = searchParams.get("id_token")

const tokenResponse = await fetch(
`https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${idToken}`
)

if (!tokenResponse.ok) {
res.send({
signedIn: isSignedin,
message: "Error when getting user"
})
return
}

const userInfo = await tokenResponse.json()

}
This is just the basic code which is responsible for oauth
15 replies
PD🧩 Plasmo Developers
Created by Asif on 1/3/2024 in #👟framework
Google & Facebook OAuth without firebase
@Lionel Yeah. I have tried this. But this doesn't work for me.
15 replies