You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a sample Azure Function locally and deployed it to Azure using the URL https://.azurewebsites.net/.auth/#/google/callback. After that, I was able to access the URL: https://.azurewebsites.net/api/. The Function App URL is now working as expected, and here are the logs:
I am trying to access the https://.azurewebsites.net/api/, which should return a JSON response: Hello, using JavaScript.
I have tried using both @react-oauth/google and passport-google-oauth2.
const GoogleStrategy = require( 'passport-google-oauth2' ).Strategy;
//Middleware
app.use(session({
secret: "secret",
resave: false ,
saveUninitialized: true ,
}))
app.use(passport.initialize()) // init passport on every route call
app.use(passport.session()) //allow passport to use "express-session"
//Get the GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET from Google Developer Console
const GOOGLE_CLIENT_ID = "3184701-tn6finlstvgcgvte2381.apps.googleusercontent.com"
const GOOGLE_CLIENT_SECRET = "XyLuTLHX6Ov_93IP"
authUser = (request, accessToken, refreshToken, profile, done) => {
return done(null, profile);
}
//Use "GoogleStrategy" as the Authentication Strategy
passport.use(new GoogleStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET,
callbackURL: "http://localhost:3001/auth/google/callback",
passReqToCallback : true
}, authUser));
passport.serializeUser( (user, done) => {
console.log(`\n--------> Serialize User:`)
console.log(user)
// The USER object is the "authenticated user" from the done() in authUser function.
// serializeUser() will attach this user to "req.session.passport.user.{user}", so that it is tied to the session object for each session.
done(null, user)
} )
However, I am receiving a 403 error. I am trying to use either @react-oauth/google or passport-google-oauth2. Any help would be appreciated. Thank you!
Sampath280
changed the title
**Feedback on How to Access the Azure Functions App with Google Authentication Using JavaScript**
Feedback on How to Access the Azure Functions App with Google Authentication Using JavaScript
Dec 5, 2024
Type of issue
Missing information
Feedback
I created a sample Azure Function locally and deployed it to Azure using the URL https://.azurewebsites.net/.auth/#/google/callback. After that, I was able to access the URL: https://.azurewebsites.net/api/. The Function App URL is now working as expected, and here are the logs:
I am trying to access the https://.azurewebsites.net/api/, which should return a JSON response: Hello, using JavaScript.
I have tried using both @react-oauth/google and passport-google-oauth2.
However, I am receiving a 403 error. I am trying to use either @react-oauth/google or passport-google-oauth2. Any help would be appreciated. Thank you!
Page URL
https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/app-service/configure-authentication-provider-google.md
Content source URL
https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-google
Author
Rageking8
Document Id
2b2f9abf-9120-4aac-ac5b-4a268d9b6e2b
The text was updated successfully, but these errors were encountered: